コード例 #1
0
ファイル: DataContext.cs プロジェクト: monankov/Structr
        protected override void OnModelCreating(DbModelBuilder builder)
        {
            builder.ApplyEntityConfiguration();
            builder.ApplyValueObjectConfiguration();
            builder.ApplyAuditableConfiguration();

            builder.Conventions.Remove <PluralizingTableNameConvention>();
            builder.Conventions.Remove <PluralizingEntitySetNameConvention>();

            builder.Properties <string>().Configure(x => x.IsUnicode(true));

            builder.Configurations.AddFromAssembly(GetType().Assembly);
        }
コード例 #2
0
        protected override void OnModelCreating(DbModelBuilder builder)
        {
            builder.ApplyEntityConfiguration();
            builder.ApplyValueObjectConfiguration(options =>
            {
                options.Configure = (typeConfiguration) =>
                {
                    foreach (var property in typeConfiguration.ClrType.GetProperties(BindingFlags.Public | BindingFlags.Instance))
                    {
                        typeConfiguration.Property(property).HasColumnName(property.Name);
                    }
                };
            });
            builder.ApplyAuditableConfiguration();

            builder.Conventions.Remove <PluralizingTableNameConvention>();
            builder.Conventions.Remove <PluralizingEntitySetNameConvention>();

            builder.Properties <string>().Configure(x => x.IsUnicode(true));

            builder.Configurations.AddFromAssembly(GetType().Assembly);
        }