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


C# AutoPersistenceModel.Override方法代碼示例

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


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

示例1: 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

示例2: 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

示例3: Generate

        public AutoPersistenceModel Generate()
        {
            var mappings = new AutoPersistenceModel();
            mappings.AddEntityAssembly(typeof(Soul).Assembly).Where(GetAutoMappingFilter);
            mappings.Conventions.Setup(GetConventions());
            mappings.Setup(GetSetup());
            mappings.IgnoreBase<Entity>();
            mappings.IgnoreBase(typeof(EntityWithTypedId<>));
            mappings.UseOverridesFromAssemblyOf<AutoPersistenceModelGenerator>();

            // Membershipprovider Automappings
            mappings.AddEntityAssembly(typeof(Shaml.Membership.Core.User).Assembly).Where(GetAutoMappingFilter);
            mappings.Override<Shaml.Membership.Core.User>(map => Shaml.Membership.Data.Overrides.UserOverride(map));
            mappings.Override<Shaml.Membership.Core.Role>(map => Shaml.Membership.Data.Overrides.RoleOverride(map));
            mappings.Override<Shaml.Membership.Core.ProfileData>(map => Shaml.Membership.Data.Overrides.ProfileDataOverride(map));
            mappings.Override<Shaml.Membership.Core.Session>(map => Shaml.Membership.Data.Overrides.SessionOverride(map));

            return mappings;
        }
開發者ID:sztupy,項目名稱:CodeChirp,代碼行數:19,代碼來源:AutoPersistenceModelGenerator.cs

示例4: Alter

        /// <summary>
        /// Alter the model
        /// </summary>
        /// <remarks>
        /// Finds all types in the assembly (passed in the constructor) that implement IAutoMappingOverride&lt;T&gt;, then
        /// creates an AutoMapping&lt;T&gt; and applies the override to it.
        /// </remarks>
        /// <param name="model">AutoPersistenceModel instance to alter</param>
        public void Alter(AutoPersistenceModel model)
        {
            // find all types deriving from IAutoMappingOverride<T>
            var types = from type in assembly.GetExportedTypes()
                        where !type.IsAbstract
                        let entity = (from interfaceType in type.GetInterfaces()
                                      where interfaceType.IsGenericType && interfaceType.GetGenericTypeDefinition() == typeof(IAutoMappingOverride<>)
                                      select interfaceType.GetGenericArguments()[0]).FirstOrDefault()
                        where entity != null
                        select type;

            foreach (var type in types)
            {
                model.Override(type);
            }
        }
開發者ID:akhuang,項目名稱:NHibernateTest,代碼行數:24,代碼來源:AutoMappingOverrideAlteration.cs

示例5: Created

 public void Created(FluentConfiguration cfg, AutoPersistenceModel defaultModel) {
     defaultModel.Override<AssetRecord>(mapping => mapping.IgnoreProperty(x => x.Infoset));
     defaultModel.Override<TaskRecord>(mapping => mapping.References(x => x.Job, "JobId"));
     defaultModel.Override<JobRecord>(mapping => mapping.HasMany(x => x.Tasks).KeyColumn("JobId"));
 }
開發者ID:jdages,項目名稱:AndrewsHouse,代碼行數:5,代碼來源:PersistenceConfiguration.cs


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