I have a combination of RIA and nHibernate services. nHibernate is configured to use database-side authentication. Therefore, new objects are sent with 0 for id. nHibernate works as it should. It updates the generated keys from the database and updates.
I have an example with compositional hierarchy. My essence is complex, it has two collections.
InvestObject
- MaterialItems
- WorkItems
I work with this structure in one part of the work. Getting and showing data in a Silverlight application is not a problem. But if I try to add several elements to the client-side MaterialItems collection, when I save, I get this error:
Error sending operation. Disabled ChangeSet: only one record for a given instance of an object can exist in a Change. in System.ServiceModel.DomainServices.Server.ChangeSet.ValidateChangeSetEntries (IEnumerable 1
changeSetEntries) at
System.ServiceModel.DomainServices.Server.ChangeSet..ctor(IEnumerable1 changeSetEntries)
There is a quick fix on the client side, just to create some dummy negative identifiers for the material. This works for the RIA, and persistence extends to the server. But then nHibernate raises an error, since it expects 0 for all new identifiers, and not for a given value (). So this is not normal.
Finally, I tricked nHibernate into translating all new identifiers to 0. But that doesn't make me happy. This is a dirty ugly decision.
Please, help
source
share