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

no faxing loans said:

Terrific read, I just passed this onto a colleague who was doing a little research on that. And he actually bought me lunch because I found it for him smile So let me rephrase that: Thanks for lunch! hvqhqeebars

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 23, 2010 2:16

cash advance loans canada said:

Wow! Thank you! I always wanted to write in my site something like that. Can I take part of your post to my blog?

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 26, 2010 12:17

loan for bad credit said:

This website is awesome. I constantly come across something new & different right here. Thank you for that data.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 27, 2010 1:05

bad credit loans canada said:

This article gives the light in which we can observe the reality. This is very nice one and gives in-depth information. Thanks for this nice article.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 27, 2010 3:26

loans bc said:

I'm doing some thing of the same interest and will be taking note on this .Thanks.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 28, 2010 1:43

payday loan ontario said:

Finally, an issue that I'm passionate about. I have looked for information of this caliber for the last several hours. Your web page is greatly appreciated.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 28, 2010 3:44

canada loans for bad credit said:

I must say that overall I'm incredibly taken with this webpage. It is apparent that you know you subject matter and you are passionate about it. I wish I had got your ability to write. I have bookmarked your web site and look forward to more updates.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 29, 2010 2:45

loans bc canada said:

Fantastic read, I just passed this onto a colleague who was doing a little research on that. And he actually bought me lunch because I found it for him smile So let me rephrase that: Thanks for lunch!

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 30, 2010 4:31

Jayden said:

AKAIK you've got the aswner in one!

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 6, 2011 11:41

Neveah said:

Wow I must confess you make some very trenchant ponits.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# desember 10, 2011 9:26
Leave a Comment

(required) 

(required) 

(optional)

(required) 

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