I am new to EPiserver and I am looking for answer to question below:
what is the prffable ways to do the dependency injection , if I need to choose btween Strucurte Map , injected proprtey , service attrubte , constructor injecton ?thanks
Short answer: constructor injection whenever possible :)
You are mixing things up a bit. StructureMap is the IoC (inversion of control) framework, and while it is the default IoC choice, you are quite free to choose other IoC like autofac (more work is needed, of course).
Service attribute is a way to register the implementation for the abstraction. I think it's OK but many developers prefer explicit registration. that's up to you.
there are 4 ways to get an instance of a dependency, in order of recommendation: constructor injection > injected property ~ service locator > new (). So yes, use constructor injector whenever possible
Thanks your quick answers :)