1

请帮助我,每当我将产品插入数据库时​​,我都会遇到此错误。

Error:System.Data.Entity.Core.MetadataException: Schema specified is not   
 valid. Errors: App_Code.Model1.csdl(3,4) : error 0019: Each type name in a  
 schema must be unique. Type name 'MC10Model.Cart' was already defined. 
 App_Code.Model1.csdl(15,4) : error 0019: Each type name in a schema must be 
 unique. Type name 'MC10Model.Product' was already defined. 
 App_Code.Model1.csdl(28,4) : error 0019: Each type name in a schema must be 
 unique. Type name 'MC10Model.ProductType' was already defined. 
 App_Code.Model1.csdl(36,4) : error 0019: Each type name in a schema must be 
 unique. Type name 'MC10Model.FK_Cart_Product' was already defined. 
 App_Code.Model1.csdl(48,4) : error 0019: Each type name in a schema must be 
 unique. Type name 'MC10Model.FK_Product_ProductTypes' was already defined. 
 App_Code.Model1.csdl(62,4) : error 0019: The EntityContainer name must be 
 unique. An EntityContainer with the name 'MC10Entities' is already defined. 
 at System.Data.Entity.Core.Metadata.Edm.EdmItemCollection.LoadItems(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, SchemaDataModelOption dataModelOption, DbProviderManifest providerManifest, ItemCollection itemCollection, Boolean throwOnError) at System.Data.Entity.Core.Metadata.Edm.EdmItemCollection.Init(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths, Boolean throwOnError) at System.Data.Entity.Core.Metadata.Edm.EdmItemCollection..ctor(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths, Boolean skipInitialization) at System.Data.Entity.Core.Metadata.Edm.MetadataCache.LoadEdmItemCollection(MetadataArtifactLoader loader) at System.Data.Entity.Core.Metadata.Edm.MetadataCache.<>c__DisplayClass5.b__0(String k) at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) at System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetMetadataWorkspace(String cacheKey, MetadataArtifactLoader artifactLoader) at System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetMetadataWorkspace(DbConnectionOptions effectiveConnectionOptions) at System.Data.Entity.Core.EntityClient.EntityConnection.GetMetadataWorkspace() at System.Data.Entity.Core.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection() at System.Data.Entity.Core.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor, ObjectQueryExecutionPlanFactory objectQueryExecutionPlanFactory, Translator translator, ColumnMapFactory columnMapFactory) at System.Data.Entity.Core.Objects.ObjectContext..ctor(EntityConnection connection) at System.Data.Entity.Internal.InternalConnection.CreateObjectContextFromConnectionModel() at System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel() at System.Data.Entity.Internal.LazyInternalContext.InitializeContext() at System.Data.Entity.Internal.InternalContext.Initialize() at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) at 
System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() at 
System.Data.Entity.Internal.Linq.InternalSet`1.ActOnSet(Action action, 
EntityState newState, Object entity, String methodName) at System.Data.Entity.Internal.Linq.InternalSet`1.Add(Object entity) at 
System.Data.Entity.DbSet`1.Add(TEntity entity) at 
Project_BT.App_Code.Models.ProductTypeModel.InsertProductType(ProductType 
productType) in c:\Users\AMNESTYUSER\Documents\NMMU\Final Year\Semester 
2\Project\Project_BT\Project_BT\App_Code\Models\ProductT`ypeModel.cs:line 15
4

0 回答 0