New Posts New Posts RSS Feed: Metadata files not found
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Metadata files not found

 Post Reply Post Reply
Author
skingaby View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 23-Apr-2008
Location: United States
Posts: 146
Post Options Post Options   Quote skingaby Quote  Post ReplyReply Direct Link To This Post Topic: Metadata files not found
    Posted: 14-Mar-2012 at 12:50pm
So we upgraded to 6.1.6 for Silverlight a couple of days ago.  I have a model project pair (one server project and one SL project).  However, when I run the module that refers to the model, I get this error:
 
System.InvalidOperationException: Entity Server Error in: MeasurementPpaRepository ---> IdeaBlade.EntityModel.EntityServerException: Key 'MeasurementPpaDataSourceKey': The model's metadata artifact files (csdl, msl, ssdl) are either invalid or could not be found, either as resources in an assembly or loose in the output directory.  Perhaps you have multiple assemblies containing the same metadata. Check the connection string for key 'MeasurementPpaDataSourceKey', which says the artifact filenames are MeasurementPpaDataSourceKey.csdl, MeasurementPpaDataSourceKey.ssdl, and MeasurementPpaDataSourceKey.msl. Do these names match the actual artifact filenames? All three root names (e.g., 'MeasurementPpaDataSourceKey') should be the same and match the edmx filename unless you changed them deliberately.
   at IdeaBlade.EntityModel.RemoteEntityServerProxyBase.CheckConnection(Exception pException)
   at IdeaBlade.EntityModel.EntityServerProxy.ExecFunc[T](Func`1 func, Boolean funcWillHandleException)
   at IdeaBlade.EntityModel.EntityServerProxy.ExecuteOnServer[T](Func`1 func, Boolean funcWillHandleException)
   at IdeaBlade.EntityModel.EntityServerProxy.Fetch(SessionBundle bundle, IEntityQuerySurrogate query)
   at IdeaBlade.EntityModel.EntityManager.AsyncFetchWorker(AsyncEventArgs asyncArgs)
   --- End of inner exception stack trace ---
   at Png.GcsAg.Infrastructure.ViewUtility.ViewModel.RepositoryEntityServerError(Object sender, EntityServerErrorEventArgs e)
   at Png.GcsAg.Infrastructure.Persistence.Repository.PersistenceContextEntityServerError(Object sender, EntityServerErrorEventArgs e)
   at Png.GcsAg.Infrastructure.Persistence.PersistenceContext.EntityManagerEntityServerError(Object sender, EntityServerErrorEventArgs e)
 
{EntityServerException: Key 'MeasurementPpaDataSourceKey': The model's metadata artifact files (csdl, msl, ssdl) are either invalid or could not be found, either as resources in an assembly or loose in the output directory.  Perhaps you have multiple assemblies containing the same metadata. Check the connection string for key 'MeasurementPpaDataSourceKey', which says the artifact filenames are MeasurementPpaDataSourceKey.csdl, MeasurementPpaDataSourceKey.ssdl, and MeasurementPpaDataSourceKey.msl. Do these names match the actual artifact filenames? All three root names (e.g., 'MeasurementPpaDataSourceKey') should be the same and match the edmx filename unless you changed them deliberately. ---> IdeaBlade.EntityModel.EntityServerException: The model's metadata artifact files (csdl, msl, ssdl) are either invalid or could not be found, either as resources in an assembly or loose in the output directory.  Perhaps you have multiple assemblies containing the same metadata. Check the connection string for key 'MeasurementPpaDataSourceKey', which says the artifact filenames are MeasurementPpaDataSourceKey.csdl, MeasurementPpaDataSourceKey.ssdl, and MeasurementPpaDataSourceKey.msl. Do these names match the actual artifact filenames? All three root names (e.g., 'MeasurementPpaDataSourceKey') should be the same and match the edmx filename unless you changed them deliberately. ---> System.Data.MetadataException: Unable to load the specified metadata resource.
   at System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.LoadResources(String assemblyName, String resourceName, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
   at System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.CreateResourceLoader(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
   at System.Data.Metadata.Edm.MetadataArtifactLoader.Create(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
   at System.Data.Metadata.Edm.MetadataCache.SplitPaths(String paths)
   at System.Data.Common.Utils.Memoizer`2.<>c__DisplayClass2.<Evaluate>b__0()
   at System.Data.Common.Utils.Memoizer`2.Result.GetValue()
   at System.Data.Common.Utils.Memoizer`2.Evaluate(TArg arg)
   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)
   at IdeaBlade.EntityModel.Edm.EdmKey.CreateObjectContext()
   at IdeaBlade.EntityModel.Edm.EdmKey.CreateContext()
   --- End of inner exception stack trace ---
   at IdeaBlade.EntityModel.Edm.EdmKey.CreateContext()
   at IdeaBlade.EntityModel.Edm.EdmKey.Initialize()
   at IdeaBlade.EntityModel.Edm.EdmKey.CreateContext()
   at IdeaBlade.EntityModel.RemoteEntityServerProxyBase.CheckConnection(Exception pException)
   at IdeaBlade.EntityModel.EntityServerProxy.ExecFunc[T](Func`1 func, Boolean funcWillHandleException)
   at IdeaBlade.EntityModel.EntityServerProxy.ExecuteOnServer[T](Func`1 func, Boolean funcWillHandleException)
   at IdeaBlade.EntityModel.EntityServerProxy.Fetch(SessionBundle bundle, IEntityQuerySurrogate query)
   at IdeaBlade.EntityModel.EntityManager.AsyncFetchWorker(AsyncEventArgs asyncArgs)}
 
Do you have any suggestions for where I should be looking to troubleshoot this error? 
I have two model project pairs and two modules.  The 6.1.5 model projects and module work just fine (with the 6.1.6 dll's).  The 6.1.6 model projects and module complain about the metadata.
Any help would be appreciated. 
Thanks,
Simon
 
Back to Top
skingaby View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 23-Apr-2008
Location: United States
Posts: 146
Post Options Post Options   Quote skingaby Quote  Post ReplyReply Direct Link To This Post Posted: 14-Mar-2012 at 1:18pm
Oh yeah.  I forgot to mention:  I have uninstalled and reinstalled Devforce 6.1.6.  I have made sure the EDM Extension is present.
Also, I am attaching some source code for the projects that work and that don't.  Open the ClassLibrary1.sln to load all 6 projects.  The EdiTransactions work, the MeasurementPPAs don't.
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 14-Mar-2012 at 1:54pm

Thanks skingaby,

 
We will take a look at it.
 
Regards,
   Silvio.
Back to Top
skingaby View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 23-Apr-2008
Location: United States
Posts: 146
Post Options Post Options   Quote skingaby Quote  Post ReplyReply Direct Link To This Post Posted: 16-Mar-2012 at 5:06am
Still wondering if you can give me a clue where to look to fix this?  Thanks.
Back to Top
skingaby View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 23-Apr-2008
Location: United States
Posts: 146
Post Options Post Options   Quote skingaby Quote  Post ReplyReply Direct Link To This Post Posted: 16-Mar-2012 at 7:08am
Nevermind.  We figured it out. 
 
We have a ton of modules and models that all use the same connection string.  So we have a CustomDataSourceKeyResolver that auto-resolves the DataSourceKey if the DataSourceKey property is set to the exact name of the .edmx file.
 
class CustomDataSourceKeyResolver : IDataSourceKeyResolver 
    {
        public IDataSourceKey GetKey(string keyName, string keyExtension, bool onServer)
        {
            if (!onServer) return null;
            try
            {
                string site = "/Ag";
#if DEBUG
                site = "/ExperimentWeb";  //When ran locally this is the site name
#endif
                System.Configuration.Configuration rootWebConfig =
                    System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(site);
 
                System.Configuration.ConnectionStringSettings connString;
                string conKey = "TheOneKey";
                if (rootWebConfig.ConnectionStrings.ConnectionStrings.Count > 0)
                {
                    conKey = string.IsNullOrEmpty(keyExtension) ? conKey : keyExtension;
                    connString = rootWebConfig.ConnectionStrings.ConnectionStrings[conKey];
                    if (connString == nullreturn null;
                }
                else
                {
                    return null;
                }
 
                bool trace = keyName != "CommonModel";
                string name = string.IsNullOrEmpty(keyExtension) ? keyName : keyName + "_" + keyExtension;
                string connectionString =
                    string.Format(
                        "metadata=res://*/{0}.csdl|res://*/{0}.ssdl|res://*/{0}.msl;provider={2};provider connection string='{1}'",
                        keyName, connString.ConnectionString, connString.ProviderName);
                return new ClientEdmKey(name, connectionString, trace, "FromResolver");
            } catch
            {
                throw new Exception("Unable to find connection information.");
            }
        }
    }
 
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 16-Mar-2012 at 10:27am
Thanks for the update, skingaby.
 
I was looking at your projects, but was having trouble as it has references to non-included assemblies and doesn't compile.
 
Silvio.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down