开发者

Where would I start if I want to create a code generator for Visual Studio 2010?

开发者 https://www.devze.com 2023-01-12 12:46 出处:网络
I use the repository pattern for pretty much all of my projects. I have a .edmx/.dbml file that has my database tables referenced, and then for each table I create a \'Tablename\'Repository.cs

I use the repository pattern for pretty much all of my projects. I have a .edmx/.dbml file that has my database tables referenced, and then for each table I create a 'Tablename'Repository.cs

Each of these classes have the same methods with only the type of table being called being changed.

public IQueryable<Area> FindAll()
publi开发者_如何转开发c IQueryable<Department> FindAll()
public IQueryable<Boss> FindAll()

Any suggestions? This would really cut my cruft development time and I think people would enjoy using it.

Thanks!


you be needing t4 templates then ...

http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx

Read Scotts as the start - he handly reference other resources to get you started and reference things for the Entity Framework/Linq2SQL

MSDN StartPage for t4


I would be the first interested in using your code!

Creating a template for Visual Studio, as jpg mentioned, is an option but you could also create an assembly library containing all the useful methods you are describing.

This is way, people could add the assembly to an already existing project more easily. If your library gets really useful, you could even open-source it on codeplex or github.

0

精彩评论

暂无评论...
验证码 换一张
取 消