The specified metadata path is not valid

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
nbonne
Posts: 16
Joined: Fri 28 Nov 2008 10:11

The specified metadata path is not valid

Post by nbonne » Fri 29 May 2009 13:03

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.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 01 Jun 2009 10:36

Thank you for the report, this problem was already reproduced.
As a temporary workaround, please set the Metadata Artifact Processing property of the model to CopyToOutputDirectory.

nbonne
Posts: 16
Joined: Fri 28 Nov 2008 10:11

Post by nbonne » Tue 02 Jun 2009 06:28

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:

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 02 Jun 2009 10:30

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:

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();
  }
}
And call it from the code like the following:

Code: Select all

using (DataSourceModel.DataSourceModelEntities db = new DataSourceModel.DataSourceModelEntities(true)) {
      //Place your code here
}
The problem is fixed in the upcoming build of Entity Developer.

nbonne
Posts: 16
Joined: Fri 28 Nov 2008 10:11

Post by nbonne » Wed 03 Jun 2009 06:14

The proposed workaround does the job ! Thanks.

nilssonm
Posts: 23
Joined: Mon 25 Aug 2008 15:08

Post by nilssonm » Mon 15 Jun 2009 08:16

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

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 15 Jun 2009 12:13

The problem is already fixed, look forward to the upcoming build of dotConnects.

nilssonm
Posts: 23
Joined: Mon 25 Aug 2008 15:08

Post by nilssonm » Mon 15 Jun 2009 14:27

When will it be released? I am kind of stuck right now.

/Mats

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 17 Jun 2009 11:36

We plan to release the new build next week.

nilssonm
Posts: 23
Joined: Mon 25 Aug 2008 15:08

Post by nilssonm » Thu 02 Jul 2009 12:05

Am I missing something or isn't it released yet?

Regards,
Mats Nilsson

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 02 Jul 2009 13:16

Sorry, the build is postponed because of some technical troubles.
I will post here as soon as it is available.

nilssonm
Posts: 23
Joined: Mon 25 Aug 2008 15:08

Post by nilssonm » Thu 02 Jul 2009 14:15

OK, I'll be watching out for the release.

/Mats

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 15 Jul 2009 06:27

The new build is available.

sclegg
Posts: 6
Joined: Fri 11 Sep 2009 15:51
Location: Idaho

Still getting this error - The specified metadata..not valid

Post by sclegg » Mon 14 Sep 2009 14:42

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!

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 18 Sep 2009 08:01

I have sent you a sample MVC project.

Post Reply