Blog'A'Little

Just another C# guy

Persistent Objects Part 2

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.

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.
http://www.drewnoakes.com/snippets/WritingACustomCodeGeneratorToolForVisualStudio/

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 (http://blog.dolittle.com/PermaLink.aspx?guid=71e1b6fd-59bf-41a5-8c33-cde01dbf9899).

kick it on DotNetKicks.com kick it on GameDevKicks.com

Comments

payday loans online said:

Your website is very great. I liked your website a lot. Thank you.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# juli 2, 2010 5:47

faxless payday loans said:

Your blog website is excellent. Thank you very much for presenting a great deal of valuable resources. I'll bookmark your post and will be most certainly coming back. Again, I value all your work moreover providing plenty of great tips to the many people.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# august 25, 2010 3:19

loans british columbia said:

vyzkgvbrryxzrwyyepdnnvgudeneuuxpcxl

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 2, 2010 3:00
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Design downloaded from Free Templates - your source for free web templates