Guest User

Untitled

a guest
Aug 10th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. What's the difference between these two StructureMap configs?
  2. ObjectFactory.Initialize(x =>
  3. {
  4. x.For<IBusinessRelationsContext>().Use<BusinessRelationsContext>().Ctor<string>().Is(ConfigurationManager.ConnectionStrings["BusinessRelationsContext"].ConnectionString);
  5. x.For<IBusinessRelationsContext>().Use(_ => new BusinessRelationsContext(ConfigurationManager.ConnectionStrings["BusinessRelationsContext"].ConnectionString));
  6. });
  7.  
  8. public BusinessRelationsContext();
  9. public BusinessRelationsContext(string connectionString);
  10. public BusinessRelationsContext(EntityConnection connection);
  11.  
  12. ObjectFactory.TryGetInstance<IBusinessRelationsContext>();
  13.  
  14. x.For<IBusinessRelationsContext>().Use(_ => new BusinessRelationsContext(ConfigurationManager.ConnectionStrings["BusinessRelationsContext"].ConnectionString));
  15.  
  16. x.SelectConstructor<IBusinessRelationsContext>(() => new BusinessRelationsContext(""));
Add Comment
Please, Sign In to add comment