Hi Paul, I appreciate your suggestions.
I had to recreate my .edmx (see the thread
http://forums.asp.net/t/1413536.aspx:
"MVC or SQL problem? not sure? ?? MVC bug(s) ??").
Therefore, based on your reply, above, I paid special attention.
As with the movie database application, and as with my previous attempt,
I carefully right-clicked the
Models folder. This time, instead of
Scripts or
Models,
it chose
Controllers:
<
add name="ArticleDBEntities" connectionString="metadata=res://*/Controllers.AriticleDBModel.csdl|res://*/Controllers.AriticleDBModel.ssdl|res://*/Controllers.AriticleDBModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\mne.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />I blew that away again, and then it chose
none of the above:
<
add name="ArticleEntities" connectionString="metadata=res://*/ArticleModel.csdl|res://*/ArticleModel.ssdl|res://*/ArticleModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\mne.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" /></connectionStrings>
Note, above: ArticleModel has no prefix.
Compare:
<add name="ArticleEntities"
connectionString="metadata=res://*/
Models.ArticleDBModel.
csdl|res://*/
Models.ArticleDBModel.
ssdl|res://*/
Models.ArticleDBModel.
msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\mne.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient"/>
Again, I got the error that follows my signature, below.
Inserting
Models. in front of
ArticleModel resolved the error.
Given the
consistently inconsistent behaviour, after 40+ years as a programmer,
to me this really looks like a
BUG!
Regards,
Gerry (Lowry)
Server Error in '/' Application.
Unable to load the specified metadata resource.
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: Unable to load the specified metadata resource.
Source Error:
Line 24: /// Initializes a new ArticleEntities object using the connection string found in the 'ArticleEntities' section of the application configuration file.
Line 25: /// </summary>
Line 26: public ArticleEntities() :
Line 27: base("name=ArticleEntities", "ArticleEntities")
Line 28: { |
Source File: c:\!!!!!mne\mne\mne\models\articlemodel.designer.cs Line: 26
Stack Trace:
[MetadataException: Unable to load the specified metadata resource.]
System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.LoadResources(String assemblyName, String resourceName, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver) +3542846
System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.CreateResourceLoader(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver) +185
System.Data.Metadata.Edm.MetadataArtifactLoader.Create(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver) +63
System.Data.EntityClient.EntityConnection.SplitPaths(String paths) +659
System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections) +148
System.Data.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection() +26
System.Data.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor) +172
System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) +27
mne.Models.ArticleEntities..ctor() in c:\!!!!!mne\mne\mne\models\articlemodel.designer.cs:26
mne.Controllers.ArticleController..ctor() in C:\!!!!!mne\mne\mne\Controllers\ArticleController.cs:21
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +86
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +230
System.Activator.CreateInstance(Type type, Boolean nonPublic) +67
System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(Type controllerType) +82
[InvalidOperationException: An error occurred while creating a controller of type 'mne.Controllers.ArticleController'. If the controller doesn't have a controller factory, ensure that it has a parameterless public constructor.]
System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(Type controllerType) +189
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +74
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +128
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +57
System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
|
Version Information: Microsoft .NET Framework Version:2.0.50727.3074; ASP.NET Version:2.0.50727.3074
Gerry Lowry, Principal
Ability Business Computer Services ~~ Because it's your Business, our Experience Counts!
68 John W. Taylor Avenue
Alliston · Ontario · Canada · L9R 0E1 · gerry.lowry@abilitybusinesscomputerservices.com
Websites:
http://abilitybusinesscomputerservices.comhttp://gerrylowryprogrammer.com ~~
résumé & testimonials
http://veganoccasions.com ~~ recipes