Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

scaffolding template for creating repositories

I'm a new comer to the Scaffold world to build repositories creating the CRUD operations.

There are a lot of scaffolding templates ,I'm so confused which one will suit my requirement .

  • I use asp.net web forms (not asp.net MVC)
  • I use Entity Framework 6 as ORM .

I want some help to clarify the main pillars we select one scaffolding template over one and what's the proper one for my case ?

NOTE : Right now i use T4Scaffolding .

like image 579
Anyname Donotcare Avatar asked Feb 05 '16 11:02

Anyname Donotcare


2 Answers

I think you can use T4Scaffolding, as you already do. But why are you using a "scaffold"? I created my crud app with entity framework without scaffolding anything.

Anyway, the scaffolding tools are all very similar, so T4Scaffolding is perfect, IMHO.

I think you can find interesting this and this.

Let me know if you have other questions.

like image 195
Piero Alberto Avatar answered Nov 09 '22 00:11

Piero Alberto


It looks like you are trying to generate repositories for each model class. If that's the case, my advice will be don't. Moreover, don't be tempted by Generic Repositories (anti-pattern) as well.

For Scaffolding
If you must use scaffolding for generating repositories around your model classes, you may refer to this link for scaffolding repositories using T4Scaffolding.

Note: If you're using Visual Studio 2013/2015, you would have to use the T4Scaffolding.VS2015 nuget package instead of the older T4Scaffolding package (for older versions of VS).

Aggregate Roots
Firstly, repositories are created on aggregate roots and not per class. Secondly, although debatable, but EF already implements these patterns.

You many want to read more on repositories; refer t the Matrin Fowler's excellent post.

Why Use Repositories anyway?
Also, there are a bunch of people against it as well importantly for good reasons.

See Rob Conery's post on it. Although, I would prefer using the below solution instead of the one recommended in the post.

The alternate?
BTW, you should consider using commands or tasks instead of respositories. Something like Ayende's post. Of course, you should evaluate your case and come up with your reasons to adopt it. It's just a suggestion, probably a good one ;)

like image 3
Muhammad Ali Avatar answered Nov 08 '22 22:11

Muhammad Ali