推送到azure后对象名称无效
本文关键字:无效 对象 azure | 更新日期: 2023-09-27 18:21:39
我正在运行一个数据库优先应用程序。在我推到azure之前,一切都很顺利,但azure似乎试图将其中一个不应该复数化的表名复数化。
错误:
Invalid object name 'dbo.ProductAttributePriceAdjustments'.
表名实际上是ProductAttributePriceAdjustment
我不太熟悉数据库优先的方法,我如何才能阻止azure尝试这样做?大多数(如果不是全部的话)其他表都有复数名称,所以我不能从整体上关闭复数。
我该怎么办?
edmx文件中的相关实体映射
<EntitySetMapping Name="ProductAttributePriceAdjustments">
<EntityTypeMapping TypeName="RPSModel.ProductAttributePriceAdjustment">
<MappingFragment StoreEntitySet="ProductAttributePriceAdjustment">
<ScalarProperty Name="AdjustmentId" ColumnName="AdjustmentId" />
<ScalarProperty Name="StoreProductId" ColumnName="StoreProductId" />
<ScalarProperty Name="StoreId" ColumnName="StoreId" />
<ScalarProperty Name="ProductId" ColumnName="ProductId" />
<ScalarProperty Name="ProductSizeId" ColumnName="ProductSizeId" />
<ScalarProperty Name="Adjustment" ColumnName="Adjustment" />
<ScalarProperty Name="PointsAdjustment" ColumnName="PointsAdjustment" />
<ScalarProperty Name="ProductColorID" ColumnName="ProductColorID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
上下文
public partial class RPSEntities : DbContext
{
public RPSEntities()
: base("name=RPSEntities1")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public DbSet<C__MigrationHistory> C__MigrationHistory { get; set; }
public DbSet<AdjustmentPriceTracking> AdjustmentPriceTrackings { get; set; }
public DbSet<Brand> Brands { get; set; }
public DbSet<ClientLogo> ClientLogos { get; set; }
public DbSet<Client> Clients { get; set; }
public DbSet<ConfirmationNumber> ConfirmationNumbers { get; set; }
public DbSet<CreditCardOrderDetail> CreditCardOrderDetails { get; set; }
public DbSet<ItemCodeException> ItemCodeExceptions { get; set; }
public DbSet<Logo> Logos { get; set; }
public DbSet<NewUserLoad> NewUserLoads { get; set; }
public DbSet<OrderItem> OrderItems { get; set; }
public DbSet<Order> Orders { get; set; }
public DbSet<OrderShippingAddress> OrderShippingAddresses { get; set; }
public DbSet<ProductAttributePriceAdjustment> ProductAttributePriceAdjustments { get; set; }
public DbSet<ProductCategory> ProductCategories { get; set; }
public DbSet<ProductColor> ProductColors { get; set; }
public DbSet<Product> Products { get; set; }
public DbSet<ProductSize> ProductSizes { get; set; }
public DbSet<ReceiptRecipient> ReceiptRecipients { get; set; }
public DbSet<SSIS_Configuration> SSIS_Configurations { get; set; }
public DbSet<StoreGroup> StoreGroups { get; set; }
public DbSet<StoreInfoProduct> StoreInfoProducts { get; set; }
public DbSet<StoreProductColor> StoreProductColors { get; set; }
public DbSet<StoreProductGroup> StoreProductGroups { get; set; }
public DbSet<StoreProductImage> StoreProductImages { get; set; }
public DbSet<StoreProductPatchAssignment> StoreProductPatchAssignments { get; set; }
public DbSet<StoreProductPricing> StoreProductPricings { get; set; }
public DbSet<StoreProduct> StoreProducts { get; set; }
public DbSet<StoreProductSize> StoreProductSizes { get; set; }
public DbSet<Store> Stores { get; set; }
public DbSet<StoreSlideshowImage> StoreSlideshowImages { get; set; }
public DbSet<StoreType> StoreTypes { get; set; }
public DbSet<StoreUserPoint> StoreUserPoints { get; set; }
public DbSet<StoreUser> StoreUsers { get; set; }
public DbSet<TempCCUserImport> TempCCUserImports { get; set; }
public DbSet<User> Users { get; set; }
public DbSet<UserType> UserTypes { get; set; }
}
我的问题是,在推送到azure之后,它试图运行Code First。我没有通过azure配置指定标准的azure连接字符串,而是在web配置中对字符串进行了硬编码,然后一切都正常了。