public static void BuildIdentityUserClaim <TKey>(this EntityMappingBuilder <IIdentityUserClaim <TKey> > builder, string tableName = UserClaimTableName)
     where TKey : IEquatable <TKey>
 {
     builder.HasTableName(tableName);
     builder.HasPrimaryKey(uc => uc.Id);
     builder.Association(x => x.User, k => k.UserId, other => other.Id, false);
 }
 public static void BuildIdentityRoleClaim <TKey>(this EntityMappingBuilder <IIdentityRoleClaim <TKey> > builder, string tableName = RoleClaimTableName)
     where TKey : IEquatable <TKey>
 {
     builder.HasTableName(tableName);
     builder.HasPrimaryKey(rc => rc.Id);
     builder.Association(x => x.Role, k => k.RoleId, other => other.Id, true);
 }
 public static void BuildIdentityUserRole <TKey>(this EntityMappingBuilder <IIdentityUserRole <TKey> > builder, string tableName = UserRoleTableName)
     where TKey : IEquatable <TKey>
 {
     builder.HasTableName(tableName);
     builder.HasPrimaryKey(r => new { r.UserId, r.RoleId });
     builder.Association(x => x.User, k => k.UserId, other => other.Id, false);
 }
예제 #4
0
        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityMappingBuilder <DiscountManufacturerMapping> builder)
        {
            builder.HasTableName(NopMappingDefaults.DiscountAppliedToManufacturersTable);
            builder.HasPrimaryKey(mapping => new { mapping.DiscountId, mapping.EntityId });

            builder.Property(mapping => mapping.DiscountId).HasColumnName("Discount_Id");
            builder.Property(mapping => mapping.EntityId).HasColumnName("Manufacturer_Id");

            builder.Ignore(mapping => mapping.Id);
        }
 public static void BuildIdentityRole <TEntity, TKey>(this EntityMappingBuilder <TEntity> builder, string tableName = RoleTableName)
     where TKey : IEquatable <TKey>
     where TEntity : class, IIdentityRole <TKey>
 {
     builder.HasTableName(tableName);
     builder.HasPrimaryKey(r => r.Id);
     builder.Property(u => u.Name).HasLength(256);
     builder.Property(u => u.NormalizedName).HasLength(256);
     //builder.HasIndex(r => r.NormalizedName).HasDatabaseName(normalizedNameIndex).IsUnique();
 }
예제 #6
0
        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityMappingBuilder <CustomerCustomerRoleMapping> builder)
        {
            builder.HasTableName(NopMappingDefaults.CustomerCustomerRoleTable);
            builder.HasPrimaryKey(mapping => new { mapping.CustomerId, mapping.CustomerRoleId });

            builder.Property(mapping => mapping.CustomerId).HasColumnName("Customer_Id");
            builder.Property(mapping => mapping.CustomerRoleId).HasColumnName("CustomerRole_Id");

            builder.Ignore(mapping => mapping.Id);
        }
 public static void BuildIdentityUser <TEntity, TKey>(this EntityMappingBuilder <TEntity> builder, StoreOptions storeOptions, DefaultPersonalDataProtector personalDataConverter, string tableName = UserTableName)
     where TKey : IEquatable <TKey>
     where TEntity : class, IIdentityUser <TKey>
 {
     builder.HasTableName(tableName);
     builder.HasPrimaryKey(u => u.Id);
     builder.Property(u => u.NormalizedName).HasLength(256);
     builder.Property(u => u.Name).HasLength(256);
     ///builder.HasIndex(u => u.NormalizedName).HasDatabaseName(normalizedNameIndex).IsUnique();
     storeOptions.EncryptIdentityPersonalData <TEntity>(personalDataConverter);
 }
예제 #8
0
        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityMappingBuilder <NewsComment> builder)
        {
            builder.HasTableName(nameof(NewsComment));
            builder.HasPrimaryKey(comment => comment.Id);

            builder.Property(comment => comment.CommentTitle);
            builder.Property(comment => comment.CommentText);
            builder.Property(comment => comment.NewsItemId);
            builder.Property(comment => comment.CustomerId);
            builder.Property(comment => comment.IsApproved);
            builder.Property(comment => comment.StoreId);
            builder.Property(comment => comment.CreatedOnUtc);
        }
        public static void BuildIdentityUserLogin <TKey>(this EntityMappingBuilder <IIdentityUserLogin <TKey> > builder, StoreOptions storeOptions, string tableName = UserLoginTableName)
            where TKey : IEquatable <TKey>
        {
            builder.HasTableName(tableName);
            builder.HasPrimaryKey(l => new { l.LoginProvider, l.ProviderKey });
            var maxKeyLength = storeOptions?.MaxLengthForKeys ?? 0;

            if (maxKeyLength > 0)
            {
                builder.Property(l => l.LoginProvider).HasLength(maxKeyLength);
                builder.Property(l => l.ProviderKey).HasLength(maxKeyLength);
            }
            builder.Association(x => x.User, k => k.UserId, other => other.Id, false);
        }
예제 #10
0
        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityMappingBuilder <ShippingMethodCountryMapping> builder)
        {
            builder.HasTableName(NopMappingDefaults.ShippingMethodRestrictionsTable);
            builder.HasPrimaryKey(mapping => new
            {
                mapping.ShippingMethodId,
                mapping.CountryId
            });

            builder.Property(mapping => mapping.ShippingMethodId).HasColumnName("ShippingMethod_Id");
            builder.Property(mapping => mapping.CountryId).HasColumnName("Country_Id");

            builder.Ignore(mapping => mapping.Id);
        }
예제 #11
0
        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityMappingBuilder <ProductProductTagMapping> builder)
        {
            builder.HasTableName(NopMappingDefaults.ProductProductTagTable);
            builder.HasPrimaryKey(mapping => new
            {
                mapping.ProductId,
                mapping.ProductTagId
            });

            builder.Property(mapping => mapping.ProductId).HasColumnName("Product_Id");
            builder.Property(mapping => mapping.ProductTagId).HasColumnName("ProductTag_Id");

            builder.Ignore(mapping => mapping.Id);
        }
        public static void BuildIdentityUserToken <TUser, TKey>(this EntityMappingBuilder <TUser> builder, StoreOptions storeOptions, DefaultPersonalDataProtector personalDataConverter, string tableName = UserTokenTableName)
            where TKey : IEquatable <TKey>
            where TUser : class, IIdentityUserToken <TKey>
        {
            builder.HasTableName(tableName);
            builder.HasPrimaryKey(t => new { t.UserId, t.LoginProvider, t.Name });
            var maxKeyLength = storeOptions?.MaxLengthForKeys ?? 0;

            if (maxKeyLength > 0)
            {
                builder.Property(t => t.LoginProvider).HasLength(maxKeyLength);
                builder.Property(t => t.Name).HasLength(maxKeyLength);
            }
            storeOptions.EncryptIdentityPersonalData <TUser>(personalDataConverter);
        }