Print Page | Close Window

POCO and XML Persistence

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1750
Printed Date: 21-Apr-2026 at 5:49am


Topic: POCO and XML Persistence
Posted By: raustring
Subject: POCO and XML Persistence
Date Posted: 26-Apr-2010 at 6:52am
I'm new to DevForce so this question may seem very basic. Do you have any examples of how to persist POCO changes to XML files. I don't understand how to 'hook in' to the server side code to accomplish this. I would like to have the same model, and client code, but have an option to persist changes to either a database or XML files.



Replies:
Posted By: IdeaBlade
Date Posted: 27-Apr-2010 at 11:23am
You can use a ServerSaving interceptor method.

In that you have access, in a server-side EntityManager, to the entities submitted for a save via EntityManager.SaveChanges(). You could then save those to XML files and either permit the save to the database to continue, or cancel it.

For into on implementing a ServerSaving interceptor, see the section "Server-Side Life Cycle Events" in the "Business Object Persistence" topic document in the Learning Resources.


Posted By: kimj
Date Posted: 27-Apr-2010 at 12:05pm
We provide full CRUD support for POCO objects too.  See page 50 in the "Business Object Persistence - Advanced.pdf" in the Learning Resources.



Print Page | Close Window