c# 4.0 - WCF DataService EF entities not found -


i have edmx model generated context. generated self tracking entities library separate project , referenced edmx model. set correct namespace in context same namespace entities.

now working works except when try create wcf data service context.

so create new objectcontext , working directly works fine.

but having referenced context + model lib , entities lib following error when loading service

the server encountered error processing request. exception message 'value cannot null. parameter name: key'. see server logs more details. exception stack trace is:

now found happen when using data service external entity lib , fix overriding createcontext

with code

collapse

system.data.metadata.edm.itemcollection itemcollection;         if (!context.metadataworkspace.trygetitemcollection               (system.data.metadata.edm.dataspace.csspace, out itemcollection))         {             var tracestring = context.createquery<clientdatastorecontainer>("clientdatastorecontainer.dataset").totracestring();         }         return context; 

now error gone next 1 , is: object mapping not found type identity 'clientdatastoreentities.data'. error occurs on .totracestring in createcontext

the ssdl file has defined type collapse

<entitysetmapping name="dataset">     <entitytypemapping typename="istypeof(clientdatastoreentities.data)"> 

so has load clientdatastoreentities.data type namespace , type of ste library have generated model.

edit:

var tracestring = context.createquery<data>("clientdatastorecontainer.dataset").totracestring(); 

it seem load types , service not have methods can call. there should 2 dataset , publisheddataset but:

<service xml:base="http://localhost:1377/wcfdataservice1.svc/"> − <workspace> <atom:title>default</atom:title> </workspace> </service>  

is get.

i ran same issue (the first 1 mention). have worked around using suggestion julie lerman in thread. other suggestion didn't work me although experiment them more since julie's solution may have performance implications since it's executed (and has cost) every query.

msdn fail work poco modelcontainer entities located in other assembly

edit: sorry, realized utilized other solution mentioned in thread.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -