<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.dolittle.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Blog&amp;#39;A&amp;#39;Little : C#, Persistency</title><link>http://www.dolittle.com/blogs/einar/archive/tags/C_2300_/Persistency/default.aspx</link><description>Tags: C#, Persistency</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>Persistent Objects Part 3</title><link>http://www.dolittle.com/blogs/einar/archive/2004/08/18/persistent-objects-part-3.aspx</link><pubDate>Wed, 18 Aug 2004 09:50:00 GMT</pubDate><guid isPermaLink="false">a744be0d-d88a-46a6-b249-55961ed4a125:11</guid><dc:creator>Einar Ingebrigtsen</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dolittle.com/blogs/einar/rsscomments.aspx?PostID=11</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dolittle.com/blogs/einar/commentapi.aspx?PostID=11</wfw:comment><comments>http://www.dolittle.com/blogs/einar/archive/2004/08/18/persistent-objects-part-3.aspx#comments</comments><description>&lt;P&gt;The one thing I find missing in other persistent object implementations is the ability to persist data from any kind of source.&lt;/P&gt;
&lt;P&gt;You could easily persist data from a Web Service, a dataset, other functionality found in your business logic. Just about anything, actually. &lt;/P&gt;
&lt;P&gt;If you look at your persistent objects a bit like facade objects, this would make a lot of sense.&lt;/P&gt;
&lt;P&gt;For instance : &lt;/P&gt;
&lt;P&gt;
&lt;TABLE style="BORDER-RIGHT:#e5e5e5 1px solid;BORDER-TOP:#e5e5e5 1px solid;BORDER-LEFT:#e5e5e5 1px solid;BORDER-BOTTOM:#e5e5e5 1px solid;BACKGROUND-COLOR:#f2f2f2;" cellSpacing=0 cellPadding=0&gt;

&lt;TR style="VERTICAL-ALIGN:top;LINE-HEIGHT:normal;"&gt;
&lt;TD style="WIDTH:40px;TEXT-ALIGN:right;"&gt;&lt;PRE style="BORDER-RIGHT:#e7e7e7 1px solid;PADDING-RIGHT:2px;PADDING-LEFT:2px;FONT-SIZE:11px;PADDING-BOTTOM:2px;MARGIN:0px;COLOR:gray;PADDING-TOP:2px;FONT-FAMILY:courier new;"&gt;1&lt;BR&gt;2&lt;BR&gt;3&lt;BR&gt;4&lt;BR&gt;5&lt;BR&gt;6&lt;BR&gt;7&lt;BR&gt;8&lt;BR&gt;9&lt;BR&gt; &lt;/PRE&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;PRE style="PADDING-RIGHT:2px;PADDING-LEFT:8px;PADDING-BOTTOM:2px;MARGIN:0px;PADDING-TOP:2px;"&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:black;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;[Persistent]&lt;BR&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;class&lt;/SPAN&gt; MyPersistentObject : PersistentObject&lt;BR&gt;{&lt;BR&gt;     [PersistentWebService(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"&amp;lt;uri for webservice&amp;gt;"&lt;/SPAN&gt;,&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"get method"&lt;/SPAN&gt;,&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"set method"&lt;/SPAN&gt;)]&lt;BR&gt;     &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;string&lt;/SPAN&gt; Name {&lt;BR&gt;          get { &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;return&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;string&lt;/SPAN&gt;.Empty; }&lt;BR&gt;          set {}&lt;BR&gt;     }&lt;BR&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/P&gt;
&lt;P&gt;The DoLittle Persistency project found at GotDotNet&amp;nbsp;is going in that direction. The implementation uses a PersistencySource and goes through a manager to get the Default source. The default behaviour can easily be changed by implementing your own source. This source could for instance get data from a file, if that is what you are trying to accomplish. &lt;/P&gt;
&lt;P&gt;It's a world of opportunities.. :)&lt;/P&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://www.dolittle.com/blogs/einar/archive/2004/08/18/persistent-objects-part-3.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.dolittle.com/blogs/einar/archive/2004/08/18/persistent-objects-part-3.aspx"border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt; &lt;a href="http://www.gamedevkicks.com/kick/?url=http://www.dolittle.com/blogs/einar/archive/2004/08/18/persistent-objects-part-3.aspx"&gt;&lt;img src="http://www.gamedevkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.dolittle.com/blogs/einar/archive/2004/08/18/persistent-objects-part-3.aspx"border="0" alt="kick it on GameDevKicks.com" /&gt;&lt;/a&gt; &lt;img src="http://www.dolittle.com/aggbug.aspx?PostID=11" width="1" height="1"&gt;</description><category domain="http://www.dolittle.com/blogs/einar/archive/tags/Persistency/default.aspx">Persistency</category><category domain="http://www.dolittle.com/blogs/einar/archive/tags/Persistent+Objects/default.aspx">Persistent Objects</category><category domain="http://www.dolittle.com/blogs/einar/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://www.dolittle.com/blogs/einar/archive/tags/ORM/default.aspx">ORM</category><category domain="http://www.dolittle.com/blogs/einar/archive/tags/Database/default.aspx">Database</category></item><item><title>Persistent Objects Part 2</title><link>http://www.dolittle.com/blogs/einar/archive/2004/08/06/persistent-objects-part-2.aspx</link><pubDate>Fri, 06 Aug 2004 16:29:00 GMT</pubDate><guid isPermaLink="false">a744be0d-d88a-46a6-b249-55961ed4a125:10</guid><dc:creator>Einar Ingebrigtsen</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dolittle.com/blogs/einar/rsscomments.aspx?PostID=10</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dolittle.com/blogs/einar/commentapi.aspx?PostID=10</wfw:comment><comments>http://www.dolittle.com/blogs/einar/archive/2004/08/06/persistent-objects-part-2.aspx#comments</comments><description>&lt;P&gt;Another aspect of creating persistent objects is the ability to design these through a visual designer such as the DataSet editor in Visual Studio. One way to go about using the same designer and get an output consisting of your objects instead of a strongly typed dataset would be to create your own custom tool.&lt;/P&gt;
&lt;P&gt;Creating your own custom tool that generates code in Visual Studio .net 2003 is somewhat interesting. Microsoft removed or made a class private in the plugin architecture of the editor that was very helpful. The class I'm referring to is the 'BaseCodeGeneratorWithSite' base class for code generator custom tools. But a quick search on Google gives you the class along with a tutorial on how to write the plugin.&lt;BR&gt;&lt;A href="http://blog.dolittle.com/ct.ashx?id=ed5fda5d-1e97-4509-befe-01e3752f9f2c&amp;amp;url=http%3a%2f%2fwww.drewnoakes.com%2fsnippets%2fWritingACustomCodeGeneratorToolForVisualStudio%2f"&gt;http://www.drewnoakes.com/snippets/WritingACustomCodeGeneratorToolForVisualStudio/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The custom tool has to implement the GenerateCode() method and do the magic. As input to this method you get the file content of the XSD file. This content can easily be transformed into whatever code you'd like. For instance, if you'd like to keep the DataSet functionality but want the dataset to be a bit smarter you can use the TypedDataSetGenerator class found in System.Data to generate a CodeDOM of the dataset and just walk this and modify the parts you want to have smarter. One thing it could do is to let all your rows have the persistent object attributes attached to it as mentioned in my other blog about Persistent Objects (&lt;A href="http://blog.dolittle.com/ct.ashx?id=ed5fda5d-1e97-4509-befe-01e3752f9f2c&amp;amp;url=http%3a%2f%2fblog.dolittle.com%2fPermaLink.aspx%3fguid%3d71e1b6fd-59bf-41a5-8c33-cde01dbf9899"&gt;http://blog.dolittle.com/PermaLink.aspx?guid=71e1b6fd-59bf-41a5-8c33-cde01dbf9899&lt;/A&gt;).&lt;/P&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://www.dolittle.com/blogs/einar/archive/2004/08/06/persistent-objects-part-2.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.dolittle.com/blogs/einar/archive/2004/08/06/persistent-objects-part-2.aspx"border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt; &lt;a href="http://www.gamedevkicks.com/kick/?url=http://www.dolittle.com/blogs/einar/archive/2004/08/06/persistent-objects-part-2.aspx"&gt;&lt;img src="http://www.gamedevkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.dolittle.com/blogs/einar/archive/2004/08/06/persistent-objects-part-2.aspx"border="0" alt="kick it on GameDevKicks.com" /&gt;&lt;/a&gt; &lt;img src="http://www.dolittle.com/aggbug.aspx?PostID=10" width="1" height="1"&gt;</description><category domain="http://www.dolittle.com/blogs/einar/archive/tags/Persistency/default.aspx">Persistency</category><category domain="http://www.dolittle.com/blogs/einar/archive/tags/Persistent+Objects/default.aspx">Persistent Objects</category><category domain="http://www.dolittle.com/blogs/einar/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://www.dolittle.com/blogs/einar/archive/tags/ORM/default.aspx">ORM</category><category domain="http://www.dolittle.com/blogs/einar/archive/tags/Database/default.aspx">Database</category></item><item><title>Persistent Objects</title><link>http://www.dolittle.com/blogs/einar/archive/2004/08/06/persistent-objects.aspx</link><pubDate>Fri, 06 Aug 2004 09:21:00 GMT</pubDate><guid isPermaLink="false">a744be0d-d88a-46a6-b249-55961ed4a125:9</guid><dc:creator>Einar Ingebrigtsen</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dolittle.com/blogs/einar/rsscomments.aspx?PostID=9</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dolittle.com/blogs/einar/commentapi.aspx?PostID=9</wfw:comment><comments>http://www.dolittle.com/blogs/einar/archive/2004/08/06/persistent-objects.aspx#comments</comments><description>&lt;DIV class=itemBodyStyle&gt;
&lt;P&gt;One of the things that are cool with .net Framework 2.0 is the ObjectSpaces. For JAVA developers this has been available for quite some time through libraries such as Hibernate. Today you get Hibernate for .net and there is also a free Objectspaces library for .net 1.1. The only thing with both these that I really find a bit odd is that they rely on XML files to configure the classes and properties to be connected to the datasource. &lt;/P&gt;
&lt;P&gt;The only benefit I can see from this is that DBAs can read the humanly readable XML file and just map out the DB schema for the developer to use. &lt;/P&gt;
&lt;P&gt;Another way to go about creating a persistent object would be to do some magic in the .net framework. The remoting framework provides us with some cool features to do this a bit more fancy and smooth for the programmer. An AOP approach by using attributes is a far more sexy solution. &lt;/P&gt;
&lt;P&gt;Let's say you have an object "Customer" and you have a property "Name" that you want to map to a table with the same name and using the column with the same name. How would the following code sound to do that trick : &lt;/P&gt;
&lt;P&gt;
&lt;TABLE style="BORDER-RIGHT:#e5e5e5 1px solid;BORDER-TOP:#e5e5e5 1px solid;BORDER-LEFT:#e5e5e5 1px solid;BORDER-BOTTOM:#e5e5e5 1px solid;BACKGROUND-COLOR:#f2f2f2;" cellSpacing=0 cellPadding=0&gt;

&lt;TR style="VERTICAL-ALIGN:top;LINE-HEIGHT:normal;"&gt;
&lt;TD style="WIDTH:40px;TEXT-ALIGN:right;"&gt;&lt;PRE style="BORDER-RIGHT:#e7e7e7 1px solid;PADDING-RIGHT:2px;PADDING-LEFT:2px;FONT-SIZE:11px;PADDING-BOTTOM:2px;MARGIN:0px;COLOR:gray;PADDING-TOP:2px;FONT-FAMILY:courier new;"&gt;1&lt;BR&gt;2&lt;BR&gt;3&lt;BR&gt;4&lt;BR&gt;5&lt;BR&gt;6&lt;BR&gt;7&lt;BR&gt;8&lt;BR&gt; &lt;/PRE&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;PRE style="PADDING-RIGHT:2px;PADDING-LEFT:8px;PADDING-BOTTOM:2px;MARGIN:0px;PADDING-TOP:2px;"&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:black;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;[PersistentObject(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"Customer"&lt;/SPAN&gt;)]&lt;BR&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;class&lt;/SPAN&gt; Customer : ContextBoundObject&lt;BR&gt;{&lt;BR&gt;      [Column(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"Name"&lt;/SPAN&gt;)]&lt;BR&gt;      &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;string&lt;/SPAN&gt; Name {&lt;BR&gt;           get {}&lt;BR&gt;      }&lt;BR&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/P&gt;
&lt;P&gt;To accomplish this, you have to use the proxy system in the remoting framework. Instead of having a server/client solution we make sure that we get a proxy no matter where it is instantiated.&lt;/P&gt;
&lt;P&gt;We need two things to achieve this.&lt;BR&gt;1. An attribute that implements the System.Runtime.Remoting.Proxies.ProxyAttribute and it's CreateInstance() method.&lt;/P&gt;
&lt;P&gt;2. We need a proxy for the object that handles the magic.&lt;/P&gt;
&lt;P&gt;The attribute can look something like this : &lt;/P&gt;
&lt;P&gt;
&lt;TABLE style="BORDER-RIGHT:#e5e5e5 1px solid;BORDER-TOP:#e5e5e5 1px solid;BORDER-LEFT:#e5e5e5 1px solid;BORDER-BOTTOM:#e5e5e5 1px solid;BACKGROUND-COLOR:#f2f2f2;" cellSpacing=0 cellPadding=0&gt;

&lt;TR style="VERTICAL-ALIGN:top;LINE-HEIGHT:normal;"&gt;
&lt;TD style="WIDTH:40px;TEXT-ALIGN:right;"&gt;&lt;PRE style="BORDER-RIGHT:#e7e7e7 1px solid;PADDING-RIGHT:2px;PADDING-LEFT:2px;FONT-SIZE:11px;PADDING-BOTTOM:2px;MARGIN:0px;COLOR:gray;PADDING-TOP:2px;FONT-FAMILY:courier new;"&gt;1&lt;BR&gt;2&lt;BR&gt;3&lt;BR&gt;4&lt;BR&gt;5&lt;BR&gt;6&lt;BR&gt;7&lt;BR&gt;8&lt;BR&gt;9&lt;BR&gt;10&lt;BR&gt;11&lt;BR&gt; &lt;/PRE&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;PRE style="PADDING-RIGHT:2px;PADDING-LEFT:8px;PADDING-BOTTOM:2px;MARGIN:0px;PADDING-TOP:2px;"&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:black;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;[AttributeUsage(AttributeTargets.Class)]&lt;BR&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;class&lt;/SPAN&gt; PersistentObjectAttribute : ProxyAttribute&lt;BR&gt;{&lt;BR&gt;    &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;public&lt;/SPAN&gt; PersistentObjectAttribute(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;string&lt;/SPAN&gt; tableName) {&lt;BR&gt;    }&lt;BR&gt;&lt;BR&gt;    &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;override&lt;/SPAN&gt; MarshalByRefObject CreateInstance(Type serverType) {&lt;BR&gt;        PersistenceProxy proxy &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; PersistenceProxy(serverType);&lt;BR&gt;        &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;return&lt;/SPAN&gt; (MarshalByRefObject)proxy.GetTransparentProxy();&lt;BR&gt;    }&lt;BR&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/P&gt;
&lt;P&gt;The proxy could look something like this : &lt;/P&gt;
&lt;P&gt;
&lt;TABLE style="BORDER-RIGHT:#e5e5e5 1px solid;BORDER-TOP:#e5e5e5 1px solid;BORDER-LEFT:#e5e5e5 1px solid;BORDER-BOTTOM:#e5e5e5 1px solid;BACKGROUND-COLOR:#f2f2f2;" cellSpacing=0 cellPadding=0&gt;

&lt;TR style="VERTICAL-ALIGN:top;LINE-HEIGHT:normal;"&gt;
&lt;TD style="WIDTH:40px;TEXT-ALIGN:right;"&gt;&lt;PRE style="BORDER-RIGHT:#e7e7e7 1px solid;PADDING-RIGHT:2px;PADDING-LEFT:2px;FONT-SIZE:11px;PADDING-BOTTOM:2px;MARGIN:0px;COLOR:gray;PADDING-TOP:2px;FONT-FAMILY:courier new;"&gt;1&lt;BR&gt;2&lt;BR&gt;3&lt;BR&gt;4&lt;BR&gt;5&lt;BR&gt;6&lt;BR&gt;7&lt;BR&gt;8&lt;BR&gt;9&lt;BR&gt;10&lt;BR&gt;11&lt;BR&gt;12&lt;BR&gt;13&lt;BR&gt;14&lt;BR&gt;15&lt;BR&gt;16&lt;BR&gt;17&lt;BR&gt;18&lt;BR&gt; &lt;/PRE&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;PRE style="PADDING-RIGHT:2px;PADDING-LEFT:8px;PADDING-BOTTOM:2px;MARGIN:0px;PADDING-TOP:2px;"&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:black;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;class&lt;/SPAN&gt; PersistenceProxy : RealProxy &lt;BR&gt;{&lt;BR&gt;    &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;public&lt;/SPAN&gt; PersistenceProxy(Type type) : &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;base&lt;/SPAN&gt;(type) {&lt;BR&gt;    }&lt;BR&gt;&lt;BR&gt;    &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;override&lt;/SPAN&gt; IMessage Invoke(IMessage msg) {&lt;BR&gt;        &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;if&lt;/SPAN&gt;( msg &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;is&lt;/SPAN&gt; IConstructionCallMessage ) {&lt;BR&gt;            &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;return&lt;/SPAN&gt; EnterpriseServicesHelper.CreateConstructionReturnMessage((IConstructionCallMessage) msg,(MarshalByRefObject)&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;this&lt;/SPAN&gt;.GetTransparentProxy());&lt;BR&gt;        }&lt;BR&gt;&lt;BR&gt;        &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:green;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;// Use reflection to get the tagged properties... &lt;/SPAN&gt;&lt;BR&gt;        &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;if&lt;/SPAN&gt;( msg.Properties[&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"__MethodName"&lt;/SPAN&gt;].Equals(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"get_Name"&lt;/SPAN&gt;) ) {&lt;BR&gt;           &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;return&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; ReturnMessage(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"Cool Name"&lt;/SPAN&gt;,&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;null&lt;/SPAN&gt;,0,&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;null&lt;/SPAN&gt;,(IMethodCallMessage)msg);&lt;BR&gt;        }&lt;BR&gt;&lt;BR&gt;        &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;throw&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; NotImplementedException(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"Need more logic..."&lt;/SPAN&gt;);&lt;BR&gt;    }&lt;BR&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;BR&gt;All you need to do is to create an instance of the Customer object and there you have your proxy. Ofcourse the solution for an entire system would include some factories for handling these objects from the DB and such, but the basics of it is pretty much as shown above. &lt;/P&gt;
&lt;P&gt;Another point is that all the solutions I've seen for having persistence on objects are focused on mapping tables and columns. This can be extended to include far more features than that. How about linking a property to a WebService, an ADO&amp;nbsp;DataSet, a static method on another object, a file... The possibilities are endless. &lt;/P&gt;
&lt;P&gt;At the moment I'm working on&amp;nbsp;a project&amp;nbsp;that will be a fully working Component for anyone to use. You'll find it at GotDotNet : &lt;/P&gt;&lt;U&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;http://www.gotdotnet.com/community/workspaces/workspace.aspx?id=0bb104cb-9ebb-4fc8-947f-2f9649f412b4&lt;/P&gt;&lt;/U&gt;&lt;/FONT&gt;
&lt;P&gt;The revised version of this blog's topic can be found on TheServerSide.net : &lt;A href="http://blog.dolittle.com/ct.ashx?id=71e1b6fd-59bf-41a5-8c33-cde01dbf9899&amp;amp;url=http%3a%2f%2fwww.theserverside.net%2fnews%2fthread.tss%3fthread_id%3d28325"&gt;http://blog.dolittle.com/ct.ashx?id=71e1b6fd-59bf-41a5-8c33-cde01dbf9899&amp;amp;url=http%3a%2f%2fwww.theserverside.net%2fnews%2fthread.tss%3fthread_id%3d28325&lt;/A&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://www.dolittle.com/blogs/einar/archive/2004/08/06/persistent-objects.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.dolittle.com/blogs/einar/archive/2004/08/06/persistent-objects.aspx"border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt; &lt;a href="http://www.gamedevkicks.com/kick/?url=http://www.dolittle.com/blogs/einar/archive/2004/08/06/persistent-objects.aspx"&gt;&lt;img src="http://www.gamedevkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.dolittle.com/blogs/einar/archive/2004/08/06/persistent-objects.aspx"border="0" alt="kick it on GameDevKicks.com" /&gt;&lt;/a&gt; &lt;img src="http://www.dolittle.com/aggbug.aspx?PostID=9" width="1" height="1"&gt;</description><category domain="http://www.dolittle.com/blogs/einar/archive/tags/Persistency/default.aspx">Persistency</category><category domain="http://www.dolittle.com/blogs/einar/archive/tags/Persistent+Objects/default.aspx">Persistent Objects</category><category domain="http://www.dolittle.com/blogs/einar/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://www.dolittle.com/blogs/einar/archive/tags/ORM/default.aspx">ORM</category><category domain="http://www.dolittle.com/blogs/einar/archive/tags/Database/default.aspx">Database</category></item></channel></rss>