Ejemplo n.º 1
0
 private static void Initialize(IInitializationExpression initializer)
 {
     initializer.Scan(Initialize);
     initializer.ForRequestedType<TextWriter>().TheDefault.Is.ConstructedBy(() => Console.Out);
     initializer.InstanceOf<IGitRepository>().Is.OfConcreteType<GitRepository>();
     AddGitChangeTypes(initializer);
     DoCustomConfiguration(initializer);
 }
Ejemplo n.º 2
0
 private void ConfigureStructureMap(IInitializationExpression initializer)
 {
     initializer.Scan(y =>
     {
         y.Assembly("TodayIShall.Core");
         y.WithDefaultConventions();
     });
     initializer.ForRequestedType<IAuthCookieGenerator>().TheDefaultIsConcreteType<AuthCookieGenerator>();
     initializer.AddRegistry(new MongoRegistry());
 }
Ejemplo n.º 3
0
        public static void ConfigureDataAccess(IInitializationExpression i, IPersistenceConfigurer databaseConfigurer, InstanceScope sessionScope, out NHibernate.Cfg.Configuration cfg)
        {
            cfg = new NHibernate.Cfg.Configuration();

            i.ForRequestedType<ISessionFactory>()
                .CacheBy(InstanceScope.Singleton)
                .TheDefault.IsThis(ConfigureNHibernate(databaseConfigurer, cfg));

            i.ForRequestedType<ISession>()
                .CacheBy(sessionScope)
                .TheDefault.Is.ConstructedBy(() =>
                                             ObjectFactory.GetInstance<ISessionFactory>
                                                 ().OpenSession());

            //More StructureMap configuration goes here:

            //i.ForRequestedType<ISomeModelRepository>()
            //    .CacheBy(InstanceScope.PerRequest)
            //    .TheDefaultIsConcreteType<SomeModelRepository>();
        }
Ejemplo n.º 4
0
 private static void InitializeStructureMap(IInitializationExpression x)
 {
     x.Scan(y =>
     {
         y.Assembly("ShortestPath.Web");
         y.Assembly("ShortestPath.Core");
         y.With<DefaultConventionScanner>();
     }
     );
     x.AddRegistry<NHibernateRegistry>();
     x.ForRequestedType<IThreadCache>().CacheBy(InstanceScope.Hybrid).TheDefaultIsConcreteType<ThreadCache>();
 }
 public void Initialize(IInitializationExpression initializer, Type t)
 {
     initializer.ForRequestedType(t).CacheBy(InstanceScope.Singleton).TheDefaultIsConcreteType(t);
 }