asowles wrote:
Thank you for the link. I had previously read that portion of the documentation.
Pardon my questions, I'm still learning LLBLGen. The documentation says that the reason that you can't use Self-Servicing is that if someone walks a child relationship, the database isnt available and it will cause an error. In my case, everything is running on the same local network. While I am using WCF for cross session communication (the service runs in session 0 on Vista and the client app is in Session 1 but it is all on the same computer), I am not using a distributed scenario (communication over the web, etc.). Is there some other reason that Self-Servicing doesn't work. Are the entities not serializable? Some other reason?
Thanks for helping me understand this better.
Why are you using a webservice if it's on the same computer? That's overhead which is really not that useful. using selfservicing will also break encapsulation, because you might fetch a customer over WCF and pass it to the client, however the client has to have the DAL locally and a connection string when you, in the client app, touch the Orders collection: it will fetch that collection on the client directly from the DB, bypassing your WCF service. This is particularly dangerous when you in the future decide to run the service on another system: it then will also break. But the bypassing of your service is already a showstopper: don't do this.
I.o.w.: either remove the service, or use adapter. Walaa describes Compact25, however that's only available in adapter, as it's meant for xml serialization which won't be used in selfservicing: lazy loading prevents selfservicing from being suitable for service oriented architectures, and also because selfservicing code has fetch logic in the entities (as it's selfservicing) as well as persistence logic, so it will always work through its own code with the DB, never with your service. Adapter has a split design: entities and persistence logic are completely separated: so you can use the entities on the client and you always have to consult the service, which is the purpose of the service in the first place.
I.o.w.: don't use selfservicing in a distributed system, even if they're running on the same computer, it's still a distributed system. Use adapter in these scenarios. If you still want to use selfservicing, drop the service (as you won't need it anyway, I don't see why one would want a slow service on the same computer as the client) and use a normal app architecture.