Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tool for POCO Generation

As a .Net hobbyist & newbie, learning c#, WPF, EntityFramework, LLBLgen WCF, I face problems while transferring objects between layers (mainly the Presentation Layer), as I work with classes having approximately 40 properties. (I don't reference the DAL in the Presentation Layer)

So here's what I decided, I am planning to build an App (maybe Visual Studio Addin) which will help noobs like me to build POCO's rapidly.

The GUI of the APP would probably be a datagrid with columns for

1) access modifiers

2) property name

3) data type

4) get method (checkbox)

5) set method (checkbox)

Also, the app will have an option to connect to the table and automatically generate a POCO class

I would like to generate Strongly typed C# / VB.NET POCO classes for different Scenarios, Like Entity Framework, LLBLgen etc.

I am mainly targeting LLBLgen and EntityFramework

I need all the help/insights/references that I can get from the .Net Gurus over here


I need the following information:

1) Is there such a tool which already exists

2) What are the things that I have to consider (like nullable types etc)

3) The DataTypes generate by ORM's LLBLgen/EF/nHibernate

4) GUI ideas

5) Your Suggestions

like image 958
Joseph Avatar asked Dec 14 '25 14:12

Joseph


1 Answers

Are you looking to do this at Runtime or Compile time?

Compile time is quite straight forward, in Entity Framework 4 there are supported templates for generating POCO's and Self Tracking Entites as part of the framework.

http://blogs.msdn.com/b/adonet/archive/2009/05/21/poco-in-the-entity-framework-part-1-the-experience.aspx

http://blogs.msdn.com/b/efdesign/archive/2009/03/24/self-tracking-entities-in-the-entity-framework.aspx

http://msdn.microsoft.com/en-us/library/dd456853.aspx

http://blogs.msdn.com/b/efdesign/ - most up to date EF info

You could look at crafting somehting yourself using T4 templates (built into VS) but thats exactly what the above templates are.

Doing it at Runtime gets a lot harder, using something like reflection.Emit.

like image 167
Doobi Avatar answered Dec 16 '25 06:12

Doobi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!