當前位置: 首頁>>代碼示例>>C#>>正文


C# AutoPersistenceModel類代碼示例

本文整理匯總了C#中AutoPersistenceModel的典型用法代碼示例。如果您正苦於以下問題:C# AutoPersistenceModel類的具體用法?C# AutoPersistenceModel怎麽用?C# AutoPersistenceModel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AutoPersistenceModel類屬於命名空間,在下文中一共展示了AutoPersistenceModel類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetSessionFactory

        public static ISessionFactory GetSessionFactory(NhDataContext context, FluentConfiguration factoryConfig, AutoPersistenceModel autoPersistanceModel = null)
        {
            var contextType = context.GetType();
            var contextAssembly = Assembly.GetAssembly(contextType);

            return _factories.GetOrAdd(contextType, CreateSessionFactory(contextAssembly, factoryConfig, autoPersistanceModel));
        }
開發者ID:OgaFuuu,項目名稱:BootSharp,代碼行數:7,代碼來源:NhHelper.cs

示例2: CreateSessionFactory

 private static ISessionFactory CreateSessionFactory(Assembly contextAssembly, IPersistenceConfigurer dbPersister, AutoPersistenceModel autoPersistanceModel = null)
 {
     // Create config
     var factoryConfig = Fluently.Configure();
     factoryConfig.Database(dbPersister);
     return CreateSessionFactory(contextAssembly, factoryConfig, autoPersistanceModel);
 }
開發者ID:OgaFuuu,項目名稱:BootSharp,代碼行數:7,代碼來源:NhHelper.cs

示例3: AdditionalModelConfig

 protected virtual void AdditionalModelConfig(AutoPersistenceModel model)
 {
     // 29.12.2011 - Who would have thought that apparently only know I managed to surpass 4000 chars.
     // seems crazy but anyways, here's a fix for NH cutting off my text
     model.Override<Content>(
         a => a.Map(c => c.Body).Length(4001).CustomSqlType("nvarchar(MAX)"));
 }
開發者ID:flq,項目名稱:Rf.Sites,代碼行數:7,代碼來源:SessionFactoryMaker.cs

示例4: MyAutoPersistenceModel

 public MyAutoPersistenceModel()
 {
     this.AutoPersistenceModel = AutoMap.AssemblyOf<Entity>(new CustomAutomappingConfiguration())
             .IgnoreBase<Entity>()
             .Override<User>(map => map.IgnoreProperty(x => x.DisplayedName))
             .Override<Appointment>(map => map.IgnoreProperty(x => x.DateRange))
             .Override<IllnessPeriod>(map => map.IgnoreProperty(p => p.Duration))
             .Override<Role>(map => map.HasManyToMany(x => x.Tasks).Cascade.All())
             .Override<DbSetting>(map => map.Map(p => p.Key).Unique())
             .Override<Patient>(map =>
             {
                 map.DynamicUpdate();
                 map.IgnoreProperty(x => x.Age);
                 map.Map(x => x.IsDeactivated).Default("0").Not.Nullable();
                 map.HasMany<Bmi>(x => x.BmiHistory).KeyColumn("Patient_Id");
                 map.HasMany<MedicalRecord>(x => x.MedicalRecords).KeyColumn("Patient_Id");
                 map.HasMany<IllnessPeriod>(x => x.IllnessHistory).KeyColumn("Patient_Id");
                 map.HasMany<Appointment>(x => x.Appointments).KeyColumn("Patient_Id");
             })
             .Override<Person>(map =>
             {
                 map.Map(p => p.FirstName).Index("idx_person_FirstName");
                 map.Map(p => p.LastName).Index("idx_person_LastName");
             })
             .Override<ApplicationStatistics>(map =>
             {
                 map.Map(e => e.IsExported).Default("0").Not.Nullable();
                 map.Map(e => e.Version).Default("\"3.0.3\"").Not.Nullable();
             })
             .Conventions.Add(DefaultCascade.SaveUpdate()
                            , DynamicUpdate.AlwaysTrue()
                            , DynamicInsert.AlwaysTrue()
                            , LazyLoad.Always());
 }
開發者ID:seniorOtaka,項目名稱:ndoctor,代碼行數:34,代碼來源:MyAutoPersistenceModel.cs

示例5: SagaPersistenceModel

        public static AutoPersistenceModel SagaPersistenceModel(IEnumerable<Type> typesToScan)
        {
            var sagaEntites = typesToScan.Where(t => typeof(ISagaEntity).IsAssignableFrom(t) && !t.IsInterface);

            var model = new AutoPersistenceModel();

            model.Conventions.AddFromAssemblyOf<IdShouldBeAssignedConvention>();

            var entityTypes = GetTypesThatShouldBeAutoMapped(sagaEntites,typesToScan);

            var assembliesContainingSagas = sagaEntites.Select(t => t.Assembly).Distinct();

            foreach (var assembly in assembliesContainingSagas)
                model.AddEntityAssembly(assembly)
                    .Where(t => entityTypes.Contains(t));

            var componentTypes = GetTypesThatShouldBeMappedAsComponents(sagaEntites);

            model.Setup(s =>
                          {
                              s.IsComponentType =
                                  type => componentTypes.Contains(type);
                          });
            return model;
        }
開發者ID:togakangaroo,項目名稱:NServiceBus,代碼行數:25,代碼來源:Create.cs

示例6: Init

		public static Configuration Init(
			ISessionStorage storage, 
			string[] mappingAssemblies,
			AutoPersistenceModel autoPersistenceModel,
			string cfgFile,
			string validatorCfgFile)
		{
			return Init(storage, mappingAssemblies, autoPersistenceModel, cfgFile, null, validatorCfgFile, null);
		}
開發者ID:EdisonCP,項目名稱:sharp-architecture,代碼行數:9,代碼來源:NHibernateSession.cs

示例7: Generate

 public AutoPersistenceModel Generate()
 {
     var mappings = new AutoPersistenceModel();
     mappings.AddEntityAssembly(typeof (Class1).Assembly).Where(GetAutoMappingFilter);
     mappings.Conventions.Setup(GetConventions());
     mappings.Setup(GetSetup());
     mappings.UseOverridesFromAssemblyOf<AutoPersistenceModelGenerator>();
     return mappings;
 }
開發者ID:jhollingworth,項目名稱:Hedgehog,代碼行數:9,代碼來源:AutoPersistenceModelGenerator.cs

示例8: Generate

 public AutoPersistenceModel Generate()
 {
     var mappings = new AutoPersistenceModel();
     mappings.AddEntityAssembly(typeof(Site).Assembly).Where(GetAutoMappingFilter);
     //    mappings.Setup(GetSetup());
     mappings.IgnoreBase<Entity>();
     mappings.IgnoreBase(typeof(EntityWithTypedId<>));
     mappings.UseOverridesFromAssemblyOf<AutoPersistenceModelGenerator>();
     return mappings;
 }
開發者ID:fudder,項目名稱:cs493,代碼行數:10,代碼來源:AutoPersistenceModelGenerator.cs

示例9: VerifyMapping

		private void VerifyMapping(AutoPersistenceModel model, Action<CompositeIdMapping> verifier)
		{
			var idMapping = model.BuildMappings()
								.First()
								.Classes
								.First()
								.Id
								;

			idMapping.ShouldBeOfType(typeof(CompositeIdMapping));
			verifier((CompositeIdMapping)idMapping);
		}
開發者ID:jjchoi,項目名稱:fluent-nhibernate,代碼行數:12,代碼來源:CompositeIdOverrides.cs

示例10: Generate

 public Configuration Generate()
 {
     var model = new AutoPersistenceModel()
                 .AddEntityAssembly(Assembly.GetExecutingAssembly())
                 .Where(x => x.Namespace.IsNotNullOrEmpty() && x.Namespace.StartsWith("FakeVader.Core.Domain"))
                 .Conventions.AddFromAssemblyOf<HasManyConvention>();
     return Fluently.Configure()
         .Database(databaseConfig)
         .Mappings(
         configuration => configuration.AutoMappings.Add(model)
         ).BuildConfiguration();
 }
開發者ID:JamesKovacs,項目名稱:prairiedevcon2010-jquerydojo,代碼行數:12,代碼來源:NHibernateMappingGenerator.cs

示例11: Generate

        public AutoPersistenceModel Generate()
        {
            var mappings = new AutoPersistenceModel();

            mappings.AddEntityAssembly(typeof (Class1).Assembly).Where(GetAutoMappingFilter);
            mappings.Conventions.Setup(GetConventions());
            mappings.Setup(GetSetup());
            mappings.UseOverridesFromAssemblyOf<AutoPersistenceModelGenerator>();

            mappings.Override<Idea>(i => i.Map(m => m.Text).CustomSqlType("TEXT"));
            mappings.Override<Comment>(c => c.Map(m => m.Text).CustomSqlType("TEXT"));

            return mappings;
        }
開發者ID:jhollingworth,項目名稱:ideas,代碼行數:14,代碼來源:AutoPersistenceModelGenerator.cs

示例12: Generate

        public AutoPersistenceModel Generate()
        {
            var mappings = new AutoPersistenceModel();

            mappings
                .AddEntityAssembly(typeof(Player).Assembly)
                .UseOverridesFromAssembly(typeof(AutoPersistenceModelGenerator).Assembly)
                .Where(GetAutoMappingFilter);
                //.Setup(GetSetup())
                //.Conventions.Setup(GetConventions);

            MapEnums(mappings);

            return mappings;
        }
開發者ID:MikeHook,項目名稱:FootyLinks,代碼行數:15,代碼來源:AutoPersistenceModelGenerator.cs

示例13: Alter

 public void Alter(AutoPersistenceModel model)
 {
     // if any type has a property of this type
     // that is of a type (or has a collection of a type)
     // that is abstract
     // is not generic
     // and inherits from entity
     // and has inheritors in the domain
     // then include that type
     // foreach property in type
     foreach (var strategyType in Strategies())
     {
         model.IncludeBase(strategyType);
     }
 }
開發者ID:bibliopedia,項目名稱:bibliopedia,代碼行數:15,代碼來源:AutoDetectStrategies.cs

示例14: fup

        public virtual void fup()
        {
            domainModel = new AutoPersistenceModel(new AutoMapConfig())
                .AddEntityAssembly(Assembly.GetAssembly(typeof(IEntity)))
                .UseOverridesFromAssemblyOf<AirplayAutoMap>();

            var dbConfig = SQLiteConfiguration.Standard.UsingFile("gema4").ShowSql();
            //var dbConfig = SQLiteConfiguration.Standard.UsingFile("gema4");

            cfg = Fluently.Configure()
                .Mappings(m => m.AutoMappings.Add(domainModel))
                .Database(dbConfig)
                .BuildConfiguration();

            sf = cfg.BuildSessionFactory();
        }
開發者ID:bjornebjornson,項目名稱:gema2010,代碼行數:16,代碼來源:ADataFix.cs

示例15: Generate

        public AutoPersistenceModel Generate()
        {
            var mappings = new AutoPersistenceModel();

            mappings = AutoMap.AssemblyOf<Domain.Entity>();
            mappings.Where(GetAutoMappingFilter);
            mappings.Conventions.Setup(GetConventions());
            mappings.UseOverridesFromAssemblyOf<AutoPersistenceModelGenerator>();
            mappings.Setup(GetSetup());
            mappings.OverrideAll(x => x.IgnoreProperties(z => z.PropertyType.IsSubclassOf(typeof(Enumeration))));

            mappings.IgnoreBase<Domain.Entity>();
            mappings.UseOverridesFromAssemblyOf<AutoPersistenceModelGenerator>();

            return mappings;
        }
開發者ID:rauhryan,項目名稱:warmup-templates,代碼行數:16,代碼來源:AutoPersistenceModelGenerator.cs


注:本文中的AutoPersistenceModel類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。