Silverlight and “entity type … is exposed…” Error

I just created a Domain Sevice Class for my Silverlight application – and I couldn’t figure out a good name for it so I decided to keep the default name. Or rather, instead of calling it “DomainService1.cs” I’d call it “DomainService.cs”. Big mistake.

I immediately got the following cryptic error messages;

Error    1    The entity type ‘BusinessApplication2.Web.Catalog’ is exposed by multiple DomainService types. Entity types cannot be shared across DomainServices.    BusinessApplication2
Error    2    The entity type ‘BusinessApplication2.Web.Image’ is exposed by multiple DomainService types. Entity types cannot be shared across DomainServices.    BusinessApplication2

So, what the heck is going on? I only have the one DomainService, so whatever’s going on, the error message is incorrect!

After loads and loads of debugging, tweaking and testing, it turns out that there is another class named DomainService. It’s located in another namespace, but that doesn’t matter, it confuses the heck out of some part of Visual Studio (RIA?).

Renaming the DomainService to something else solved the problem. Live and learn!

About mfagerlund
Writes code in my sleep - and sometimes it even compiles!

4 Responses to Silverlight and “entity type … is exposed…” Error

  1. haydndup says:

    Thanks for this! I wasted a good few hours trying to figure this out. Your post solved it!

  2. anna says:

    Thank you!
    It did turn out there was another (test) domainservice hanging around somewhere…
    I think you saved me hours of work!🙂

  3. Ahmadreza says:

    Thanks,
    I had same problem because I named my DomainService class exactly the same and I was struggling with this error about an hour.

  4. Pingback: 2010 in review « Mattias Fagerlund's Coding Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: