2013-01-31 4 views
0

나는이 질문이 여러 번 전에 물어 봤고 여기에 많은 도움이되는 게시물이 있다는 것을 깨달았습니다. ... http://blogs.teamb.com/craigstuntz/2010/08/13/38628/ 하지만 불행히도 제안 사항 중 어느 것도 저에게 효과가 없었으므로 누군가 내가 보지 못했던 것을 발견 할 수 있기를 바라는 마음으로 글을 올렸습니다.MetadataException : 연결 문자열

데이터베이스 프로젝트 Sp_CodeGenerator가 있습니다. 데이터베이스에 연결했습니다. 내 연결 문자열 내가 DLL //Sp_CodeGenerator/Sp_CodeGenerator.Model.csdl 등의 이름으로 //*/Sp_CodeGenerator.Model...을 대체 시도

<add name="AdWorksLTEntities" connectionString="metadata=res://*/Sp_CodeGenerator.Model1.csdl|res://*/Sp_CodeGenerator.Model1.ssdl|res://*/Sp_CodeGenerator.Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=EIRCOM;Initial Catalog=AdventureWorksLT2008R2;Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework&quot;" providerName="System.Data.EntityClient"/>

입니다 그러나 그것은 작동하지 않습니다.

또한 .config 파일의 모든 참조를 제거하고 Entity Framework에서 생성 된 .edmx 파일과 서식 파일을 제거하고 여러 번 시작했지만 작동하지 않습니다.

내 디렉토리 구조에서 edmx 파일 : Model1.csdl, Model1.msl, Model1.ssdl은 edmxResourcesToEmbed라는 폴더에 있으며 C : \ Sp_CodeGenerator \ Sp_CodeGenerator \ obj \ x86에 있습니다.

그래서 전체 경로 는 C : \ Sp_CodeGenerator \ Sp_CodeGenerator \ OBJ \ 86 \ 디버그 \ edmxResourcesToEmbed

나는 그것이 우연의 일치인지 모르겠지만, 문제가 등장하면 나는 또한 내가 가지고있는 것으로 나타났습니다 'entityFramework' 'defaultconnectionFactory' 'type'등의 스키마 누락에 대한 .config 파일을 열면 여러 메시지가 표시됩니다.

다음에 어디서 볼 것인지 제안 해 주시면 대단히 감사하겠습니다. 난 그냥 Sp_CodeGenerator을 제거하기 위해 필요 -

MetadataException의 전체 스택 추적 내가 해결책을 발견

at System.Data.Metadata.Edm.MetadataArtifactLoaderResource.LoadResource() 
    at System.Data.Metadata.Edm.MetadataArtifactLoaderResource.CreateReader() 
    at System.Data.Metadata.Edm.MetadataArtifactLoaderResource.CreateReaders(DataSpace  spaceToGet) 
    at System.Data.Metadata.Edm.MetadataArtifactLoaderComposite.CreateReaders(DataSpace spaceToGet) 
    at System.Data.Metadata.Edm.MetadataCache.EdmMetadataEntry.LoadEdmItemCollection(MetadataArtifactLoader loader) 
    at System.Data.Metadata.Edm.MetadataCache.EdmItemCollectionLoader.LoadItemCollection(EdmMetadataEntry entry) 
    at System.Data.Metadata.Edm.MetadataCache.LoadItemCollection[T](IItemCollectionLoader`1 itemCollectionLoader, T entry) 
    at System.Data.Metadata.Edm.MetadataCache.GetOrCreateEdmItemCollection(String cacheKey, MetadataArtifactLoader loader, Object& entryToken) 
    at System.Data.EntityClient.EntityConnection.LoadEdmItemCollection(MetadataWorkspace workspace, MetadataArtifactLoader artifactLoader) 
    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(EntityConnection connection) 
    at System.Data.Entity.Internal.InternalConnection.CreateObjectContextFromConnectionModel() 
    at System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel() 
    at System.Data.Entity.Internal.LazyInternalContext.InitializeContext() 
    at System.Data.Entity.Internal.InternalContext.Initialize() 
    at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) 
    at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() 
    at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() 
    at System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() 
    at System.Linq.Queryable.OrderBy[TSource,TKey](IQueryable`1 source, Expression`1 keySelector) 
    at Sp_CodeGenerator.SelectAll.SelectAll_Method() in C:\Sp_CodeGenerator\Sp_CodeGenerator\Templates\dbo.SelectAll.StoredProcedure.sql.xml.cs:line 14 
    at Sp_CodeGenerator.Program.Main(String[] args) in C:\Sp_CodeGenerator\Sp_CodeGenerator\Program.cs:line 15 
    at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) 
    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) 
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state) 
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
    at System.Threading.ThreadHelper.ThreadStart() 

답변

0

입니다. infront 각 연결 문자열에서 Model1. 왜 처음에는 연결 문자열이 생성되었는지 확실하지 않습니다. 어쩌면 내 디렉토리 구조와 관련이 있을까요?