开发者

Using Lightswitch with my own Domain object : missing reference

I'm working on an asp.net application. I have a Domain assembly (containing mostly command and queries code), a Domain.Contract assembly ( containing mostly the domain objets), a Repository (called by the Domain) and the Web site.

For some specific backoffice needs, I want to create a Lightswitch application. I want to use my current domain as a datasource. I added a W开发者_StackOverflow社区CF Ria Service class Library, and in the RiaService.Web project, added a class based on DomainService, with one query method. Nothing more (no entities, since they are in my Domain.Contract assembly)

Using help from here (thanks Michael W), I was able to add the datasource, and to get my domain object recognized as an entity in light switch.

But, I now have a compile error : 'The type or namespace name 'MyDomain' could not be found in the global namespace (are you missing an assembly reference?)' in the project ServerGenerated.

The specific error is on this line : global::Domain.Contract.MyObject result = new global::Domain.Contract.MyObject(); which is on of my domain objects (created in my Domain.Contract assembly).

So, it seems that the only thing I need to do is to add a reference do Domain.contract to the ServerGenerated project.

But it does not appear in Visual Studio. Adding my reference to the Server project does not fix the error.

Thanks.


In your solution explorer windows, select the ServerGenerated assembly and click on the "show all files" button. This will show all hidden folders - including the generated client code for WCF Ria.

If there's no generated code this means there's either something wrong with the service implementation (typically you'd get a compilation error) or there's something else wrong with the service - like a missing [EnableClientAccess] attribute (I know for a fact that a service without this attribute does not generate client code).

Other things to check for is to include the server-side ria assembly in your host project + have a correct configuration for WCF ria in the .config file (ask google).


In your solution explorer windows, select the project and click on the "show all files" button and also select the "file view" (not the logical view).

Then add the reference to the projet "ServerGenerated" (not the server project)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜