protected override void OnBeforeMapClass(IModelInspector modelInspector, Type type, IClassAttributesMapper classCustomizer)
        {
            classCustomizer.DynamicInsert(DynamicInsert);
            classCustomizer.DynamicUpdate(DynamicUpdate);

            classCustomizer.Table(GetTableName(modelInspector, type));

            classCustomizer.Id(
                m =>
            {
                m.Column(GetKeyColumnName(modelInspector, type, false));
                m.Generator(Generators.HighLow);
            });

            if (modelInspector.IsTablePerClassHierarchy(type))
            {
                classCustomizer.Discriminator(m => m.Column(GetDiscriminatorColumnName(modelInspector, type)));
                classCustomizer.DiscriminatorValue(GetDiscriminatorValue(modelInspector, type));
            }

            MemberInfo[] versionProperties = VersionProperties(modelInspector, type).ToArray();
            if (versionProperties.Length == 1)
            {
                classCustomizer.Version(versionProperties[0], m => m.Column(GetVersionColumnName(modelInspector, type)));
            }
        }
Beispiel #2
0
 private void ConfigureDiscriminatorColumn(IModelInspector modelInspector, Type type, IClassAttributesMapper classCustomizer)
 {
     if (modelInspector.IsTablePerClassHierarchy(type))
     {
         classCustomizer.Discriminator(x => x.Column(type.Name + "Type"));
     }
 }
Beispiel #3
0
        private void DicriminatorColumnNamedClass(IModelInspector modelInspector, Type type, IClassAttributesMapper classCustomizer)
        {
            if(DiscriminatorIsNotRequired(type)) return;

            classCustomizer.Discriminator(
                dm =>
                    {
                        dm.Column("Class");
                        dm.NotNullable(true);
                    });
        }
        protected override void OnBeforeMapClass(IModelInspector modelInspector, Type type, IClassAttributesMapper classCustomizer)
        {
            classCustomizer.DynamicInsert(DynamicInsert);
            classCustomizer.DynamicUpdate(DynamicUpdate);

            classCustomizer.Table(GetTableName(modelInspector, type));

            classCustomizer.Id(
                m =>
                {
                    m.Column(GetKeyColumnName(modelInspector, type, false));
                    m.Generator(Generators.HighLow);
                });

            if (modelInspector.IsTablePerClassHierarchy(type))
            {
                classCustomizer.Discriminator(m => m.Column(GetDiscriminatorColumnName(modelInspector, type)));
                classCustomizer.DiscriminatorValue(GetDiscriminatorValue(modelInspector, type));
            }

            MemberInfo[] versionProperties = VersionProperties(modelInspector, type).ToArray();
            if (versionProperties.Length == 1)
            {
                classCustomizer.Version(versionProperties[0], m => m.Column(GetVersionColumnName(modelInspector, type)));
            }
        }