Q:

How to make schemas unique in entity framework because of Error: Schema specified is not valid. Errors:0019 ..?

I have created one EDMX type file in my Models folder in Class Library Project. In that Class Library Project I created it as a MVC project with Controllers,Models,Views. In that Models Folder I created the EDMX file named as Model1.EDMX. When I run the project the following error is thrown. I dont know why it is happening. I have only one EDMX file in my project.
The Error is:
Server Error in '/' Application.
Schema specified is not valid. Errors:
Models.Model1.csdl(3,4) : error 0019: The EntityContainer name must be unique. An EntityContainer with the name 'PivotEntities' is already defined.
Models.Model1.csdl(8,4) : error 0019: Each type name in a schema must be unique. Type name 'PivotModel.Plan_S' was already defined.
Models.Model1.csdl(16,4) : error 0019: Each type name in a schema must be unique. Type name 'PivotModel.PlanDetail' was already defined.
Models.Model1.csdl(26,4) : error 0019: Each type name in a schema must be unique. Type name 'PivotModel.PlanFeature' was already defined.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.MetadataException: Schema specified is not valid. Errors:
Models.Model1.csdl(3,4) : error 0019: The EntityContainer name must be unique. An EntityContainer with the name 'PivotEntities' is already defined.
Models.Model1.csdl(8,4) : error 0019: Each type name in a schema must be unique. Type name 'PivotModel.Plan_S' was already defined.
Models.Model1.csdl(16,4) : error 0019: Each type name in a schema must be unique. Type name 'PivotModel.PlanDetail' was already defined.
Models.Model1.csdl(26,4) : error 0019: Each type name in a schema must be unique. Type name 'PivotModel.PlanFeature' was already defined.

Source Error:

Line 12: @if (!String.IsNullOrEmpty(Model.ConfigurationActionName))
Line 13: {
Line 14:     @Html.Action(Model.ConfigurationActionName, Model.ConfigurationControllerName, Model.ConfigurationRouteValues);
Line 15: }
Line 16: else

Source File: c:\Users\rajesh.kannan\Downloads\nopcomnew\Presentation\Nop.Web\Administration\Views\Plugin\ConfigureMiscPlugin.cshtml    Line: 14

Stack Trace:

[MetadataException: Schema specified is not valid. Errors: 
Models.Model1.csdl(3,4) : error 0019: The EntityContainer name must be unique. An EntityContainer with the name 'PivotEntities' is already defined.
Models.Model1.csdl(8,4) : error 0019: Each type name in a schema must be unique. Type name 'PivotModel.Plan_S' was already defined.
Models.Model1.csdl(16,4) : error 0019: Each type name in a schema must be unique. Type name 'PivotModel.PlanDetail' was already defined.
Models.Model1.csdl(26,4) : error 0019: Each type name in a schema must be unique. Type name 'PivotModel.PlanFeature' was already defined.]
   System.Data.Metadata.Edm.EdmItemCollection.LoadItems(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, SchemaDataModelOption dataModelOption, DbProviderManifest providerManifest, ItemCollection itemCollection, Boolean throwOnError) +8404337
   System.Data.Metadata.Edm.EdmItemCollection.Init(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths, Boolean throwOnError) +119
   System.Data.Metadata.Edm.EdmItemCollection..ctor(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths) +157
   System.Data.Metadata.Edm.EdmMetadataEntry.LoadEdmItemCollection(MetadataArtifactLoader loader) +87
   System.Data.Metadata.Edm.EdmItemCollectionLoader.LoadItemCollection(EdmMetadataEntry entry) +12
   System.Data.Metadata.Edm.MetadataCache.LoadItemCollection(IItemCollectionLoader`1 itemCollectionLoader, T entry) +163
   System.Data.Metadata.Edm.MetadataCache.GetOrCreateEdmItemCollection(String cacheKey, MetadataArtifactLoader loader, Object& entryToken) +132
   System.Data.EntityClient.EntityConnection.LoadEdmItemCollection(MetadataWorkspace workspace, MetadataArtifactLoader artifactLoader) +103
   System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections) +377
   System.Data.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection() +25
   System.Data.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor) +165
   System.Data.Objects.ObjectContext..ctor(EntityConnection connection) +61
   System.Data.Entity.Internal.InternalConnection.CreateObjectContextFromConnectionModel() +128
   System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel() +44
   System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +292
   System.Data.Entity.Internal.InternalContext.Initialize() +31
   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +39
   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +137
   System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +38
   System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +84
   System.Linq.Queryable.Select(IQueryable`1 source, Expression`1 selector) +66
   Nop.Plugin.Widgets.Settings.Controllers.EditController.Configure() +1300
   lambda_method(Closure , ControllerBase , Object[] ) +101
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +59
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +435
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +60
   System.Web.Mvc.Async.AsyncControllerActionInvoker.InvokeSynchronousActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +50
   System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +75
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +44
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +139
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +49
   System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +126
   System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +323
   System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +44
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +139
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +50
   System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +68
   System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +184
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +136
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40
   System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +40
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +47
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +151
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +47
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +151
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +45
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +47
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +151
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38
   System.Web.Mvc.<>c__DisplayClassa.<EndProcessRequest>b__9() +44
   System.Web.Mvc.<>c__DisplayClass4.<Wrap>b__3() +34
   System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func`1 func) +69
   System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Action action) +123
   System.Web.Mvc.ServerExecuteHttpHandlerAsyncWrapper.EndProcessRequest(IAsyncResult result) +133
   System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +1464

[HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.]
   System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +3123183
   System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage) +76
   System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +28
   System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +19
   System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter) +985
   System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues) +112
   ASP._Page_Administration_Views_Plugin_ConfigureMiscPlugin_cshtml.Execute() in c:\Users\rajesh.kannan\Downloads\nopcomnew\Presentation\Nop.Web\Administration\Views\Plugin\ConfigureMiscPlugin.cshtml:14
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +119
   System.Web.WebPages.StartPage.RunPage() +17
   System.Web.WebPages.StartPage.ExecutePageHierarchy() +62
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +76
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +743
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +382
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +431
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +39
   System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +74
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +388
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +72
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +388
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +72
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +388
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +72
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +388
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +72
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +303
   System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +155
   System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +184
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +136
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40
   System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +40
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +47
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +151
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +47
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +151
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +45
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +47
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +151
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9629296
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18034 

What is the problem..?
Please help me on this issue.
Thanks in Advance.

A:

I have solved the problem. 
I had two class library projects and I created the EDMX file on both these projects, also they have the same Entity container Name as "PivotEntities" that is autogenerated by EDMX. 
For eg. the two library projects named as Nop.Plugin.settings and Nop.Plugin.admin.

Cause of the error:

1.I added EDMX to the above projects and then the .dll of the Nop.Plugin.settings or added it's reference to the MVC main project.
2.Then deleted the dll of that project (Nop.Plugin.Settings) or it's reference from the main project or startup project. 
3.Then I added the .dll of Nop.Plugin.admin project or it's reference to the MVC main project. 
4.When I run the Main Mvc project, it throws the Error. 

Solution:

1.I went to the Main Mvc project and clicked show all files.
2.So that it shows the hidden files in the references and there I found Nop.Plugin.settings.dll,Nop.Plugin.settings.pdb,Nop.Plugin.admin.dll and Nop.Plugin.admin.pdb.
3.Actually I have deleted the reference of the project Nop.Plugin.Setttings from the startup MVC project, but it is still residing in the startup project which causes the problem.
So now I need only the dll and pdb of Nop.Plugin.admin project and I deleted Nop.Plugin.settings.pdb and Nop.Plugin.settings.dll in the hidden BIN FOLDER.
:)

