コード例 #1
0
        void DiscoverClassMapsAndAddAssemblies(ITypeDiscoverer typeDiscoverer, MappingConfiguration mappings)
        {
            var assemblies = typeDiscoverer.FindMultiple(typeof(IMappingProvider)).Select(t => t.Assembly).Distinct();

            foreach (var assembly in assemblies)
            {
                mappings.FluentMappings.AddFromAssembly(assembly).Conventions.Add(DefaultLazy.Never(), AutoImport.Never());
                mappings.HbmMappings.AddFromAssembly(assembly);
            }
        }
コード例 #2
0
        public void Apply(MappingConfiguration configuration)
        {
            var conventions = configuration.FluentMappings.Conventions;

            //conventions.Add(ConventionBuilder
            //                    .Class.Always(
            //                        x => x.Table(Inflector.Net.Inflector.Pluralize(x.EntityType.Name).Escape())));
            conventions.Add(ConventionBuilder.Property.Always(x => x.Column(x.Property.Name)));
            conventions.Add(DefaultLazy.Always());
        }
コード例 #3
0
ファイル: FedTaxTableMap.cs プロジェクト: goliasse/PayMaster
 public FedTaxTableMap()
 {
     DefaultLazy.Always();
     Id(x => x.Id);                             //, map => map.Generator(Generators.Assigned));
     Map(x => x.Year).Not.Nullable();           //, map => map.NotNullable(true));
     Map(x => x.Payfrequency).Not.Nullable();   //, map => map.NotNullable(true));
     Map(x => x.Maritalsatus).Not.Nullable();   //, map => map.NotNullable(true));
     Map(x => x.Over).Not.Nullable();           //, map => map.NotNullable(true));
     Map(x => x.Withhold).Not.Nullable();       //, map => map.NotNullable(true));
     Map(x => x.Pluspercentage).Not.Nullable(); //, map => map.NotNullable(true));
 }
コード例 #4
0
        private void ConfigureMappings(MappingConfiguration config)
        {
            Database.Configuration.Mappings.ForEach(map => config.FluentMappings.AddFromAssembly(map));

            config.FluentMappings.Conventions.Add <EnumConvention>();
            config.FluentMappings.Conventions.Add <MonthConvention>();

            config.FluentMappings.Conventions.Add(
                DefaultLazy.Always(),
                DefaultCascade.None(),
                DynamicInsert.AlwaysTrue(),
                DynamicUpdate.AlwaysTrue());
        }
コード例 #5
0
        public static IConvention[] AllConventions(string referenceSuffix = "", bool toLowercase = true)
        {
            IList <IConvention> lcase =
                new IConvention[]
            {
                Table.Is(x => x.EntityType.Name.ToLowercaseNamingConvention(toLowercase))
                , ConventionBuilder.Property.Always(x => x.Column(x.Name.ToLowercaseNamingConvention(toLowercase)))
                , ConventionBuilder.Id.Always(x => x.Column(x.Name.ToLowercaseNamingConvention(toLowercase)))
                , LowercaseForeignKey.EndsWith(referenceSuffix, toLowercase),
                new ColumnNullabilityConvention(),
                DefaultLazy.Never()
            };

            return(lcase.ToArray());
        }