The specified metadata path is not valid
The specified metadata path is not valid
I have added a Devart Entity model in VS2008 (Add new Item) and added 4 tables generated from an Oracle DB. The model validates in the Entity Developer,the appropriate classes are generated and the project builds successfully.
When I instantiate the entities model I get an exception on the (auto-generated) constructor.
The error I get = "The specified metadata path is not valid"
Example code below (I cleared out the password)
public DavinciGpsModel2Entities() :
base(@"metadata=DavinciGpsModel2.csdl|DavinciGpsModel2.ssdl|DavinciGpsModel2.msl;provider=Devart.Data.Oracle;provider connection string=""User Id=sysadm;Password=;Server=das01.dal.na.levi.com;Home=orahome92;Persist Security Info=True""", "DavinciGpsModel2Entities")
{
this.OnContextCreated();
}
I am using oracle dotconnect version = 5.20.33.0 and entity developer version =2.0.21.0 and receive the same error even if I add another Entity model.
When I instantiate the entities model I get an exception on the (auto-generated) constructor.
The error I get = "The specified metadata path is not valid"
Example code below (I cleared out the password)
public DavinciGpsModel2Entities() :
base(@"metadata=DavinciGpsModel2.csdl|DavinciGpsModel2.ssdl|DavinciGpsModel2.msl;provider=Devart.Data.Oracle;provider connection string=""User Id=sysadm;Password=;Server=das01.dal.na.levi.com;Home=orahome92;Persist Security Info=True""", "DavinciGpsModel2Entities")
{
this.OnContextCreated();
}
I am using oracle dotconnect version = 5.20.33.0 and entity developer version =2.0.21.0 and receive the same error even if I add another Entity model.
Unfortunately the workaround does not help. I changed this property to CopyToOutputDirectory and additionaly copied the csdl, msl and ssdl files to the output directory of my test project (that is referencing the entity model project) but still same error (see below). Anything else I can try ? I am eager to use the entity developer ...
System.Data.MetadataException occurred
Message="The specified metadata path is not valid. A valid path must be either an existing directory, an existing file with extension '.csdl', '.ssdl', or '.msl', or a URI that identifies an embedded resource."
Source="System.Data.Entity"
StackTrace:
at System.Data.Metadata.Edm.MetadataArtifactLoader.Create(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.EntityClient.EntityConnection.SplitPaths(String paths)
at System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections)
at System.Data.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection()
at System.Data.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor)
at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)
at Gps.DavinciGPSModel.DavinciGPSModel..ctor() in c:\projects\levis\gps\main\davincientitymodel\davincigpsmodel.designer.cs:line 29
InnerException:
System.Data.MetadataException occurred
Message="The specified metadata path is not valid. A valid path must be either an existing directory, an existing file with extension '.csdl', '.ssdl', or '.msl', or a URI that identifies an embedded resource."
Source="System.Data.Entity"
StackTrace:
at System.Data.Metadata.Edm.MetadataArtifactLoader.Create(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.EntityClient.EntityConnection.SplitPaths(String paths)
at System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections)
at System.Data.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection()
at System.Data.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor)
at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)
at Gps.DavinciGPSModel.DavinciGPSModel..ctor() in c:\projects\levis\gps\main\davincientitymodel\davincigpsmodel.designer.cs:line 29
InnerException:
I have just succeeded in using the workaround using Console and Windows Forms applications. If you have a Web Site, this would not work.
There is an alternative workaround for Web Site.
You can make a fake constructor for ObjectContext (with bool parameter, for example) and call it instead of the default parameterless one.
Put the fake constructor to the DataSourcemodel.cs file so that it would not be influenced with model changes:
And call it from the code like the following:
The problem is fixed in the upcoming build of Entity Developer.
There is an alternative workaround for Web Site.
You can make a fake constructor for ObjectContext (with bool parameter, for example) and call it instead of the default parameterless one.
Put the fake constructor to the DataSourcemodel.cs file so that it would not be influenced with model changes:
Code: Select all
partial class DataSourceModelEntities {
// Place your implementation of partial extension methods here
public DataSourceModelEntities (bool workAround) :
base(@"metadata=~/App_Code/DataSourceModel.csdl|~/App_Code/DataSourceModel.ssdl|~/App_Code/DataSourceModel.msl;provider=Devart.Data.Oracle;provider connection string=""User Id=scott;Password=tiger;Server=ora;Home=oraclient11g_home1;Persist Security Info=True""", "DataSourceModelEntities") {
this.OnContextCreated();
}
}
Code: Select all
using (DataSourceModel.DataSourceModelEntities db = new DataSourceModel.DataSourceModelEntities(true)) {
//Place your code here
}
I cannot get this to work.
Is it possible to run the Entity Developer through the VS integration or do I have to run it standalone?
My solution in VS is setup to produce a separate assembly for the entity model to be referenced by my web-application project and I'm not getting any .csdl, .ssdl or .msl-files anywhere when I'm using the VS integration. The only way is to run it standalone which produces the files in same directory as the model file. This is a little bit anoying during a development phase.
Do I have to release these model files allthe way to production environment too? Do they have to be somewhere in the web-application directory structure?
/Mats
Is it possible to run the Entity Developer through the VS integration or do I have to run it standalone?
My solution in VS is setup to produce a separate assembly for the entity model to be referenced by my web-application project and I'm not getting any .csdl, .ssdl or .msl-files anywhere when I'm using the VS integration. The only way is to run it standalone which produces the files in same directory as the model file. This is a little bit anoying during a development phase.
Do I have to release these model files allthe way to production environment too? Do they have to be somewhere in the web-application directory structure?
/Mats
Still getting this error - The specified metadata..not valid
I created a new ASP.NET MVC project, within this project, I copied the cs file from the result of the generate process in Entity Developer into the Models folder. Next, I copied the remaining files, *model.csdl, *model.msl, *model.ssdl, into the root directory of the project. Next, I created a repository class file in the Models folder to call a stored procedure function within the model. Next, in the Controllers-> HomeController.cs file, within the Index method, I added a call to the repository class. Everything compiles fine without any error. However, at run time, with the latest build, 5.25.42.0, of dotConnect for Oracle Professional Setup, I'm getting this error:
System.Data.MetadataException was unhandled by user code
Message="The specified metadata path is not valid. A valid path must be either an existing directory, an existing file with extension '.csdl', '.ssdl', or '.msl', or a URI that identifies an embedded resource."
Source="System.Data.Entity"
StackTrace:
at System.Data.Metadata.Edm.MetadataArtifactLoader.Create(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.EntityClient.EntityConnection.SplitPaths(String paths)
at System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections)
at System.Data.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection()
at System.Data.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor)
at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)...
The above work around is not working for me in ASP.NET MVC project. Am I missing something with the path of the meta data files? Is there an update to the Entity Devleoper with this installation package or is that separate? Please advise.
Thanks!
System.Data.MetadataException was unhandled by user code
Message="The specified metadata path is not valid. A valid path must be either an existing directory, an existing file with extension '.csdl', '.ssdl', or '.msl', or a URI that identifies an embedded resource."
Source="System.Data.Entity"
StackTrace:
at System.Data.Metadata.Edm.MetadataArtifactLoader.Create(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.EntityClient.EntityConnection.SplitPaths(String paths)
at System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections)
at System.Data.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection()
at System.Data.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor)
at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)...
The above work around is not working for me in ASP.NET MVC project. Am I missing something with the path of the meta data files? Is there an update to the Entity Devleoper with this installation package or is that separate? Please advise.
Thanks!