4

I have ASP.NET project and I want to know what is better to use.

ODBC connection and with Server Explorer (drag and drop make DataSet and modify it) or do some DBconnect class with connection to database, queries and use it for GridView?

When I use server explorer, I don't have good feeling because all logic is on aspx page and I do not separate from the application layer logic layer.

It will be a lagre application, databese(PostreSQL) have 18 tables and difficult constraints and application have to generate some documents etc. .

Cœur
  • 37,241
  • 25
  • 195
  • 267
Eduard Baraniak
  • 421
  • 1
  • 10
  • 31
  • It depends on some of the details of your project. Is the data from a single database table? Is this going to be a large application? Is this application going to change much after its original development? If you are going for quick and dirty, you might want to look into Entity Framework. – Jeremy Sullivan Jun 02 '11 at 17:52
  • @Jeremy why would you consider Entity Framework a "quick and dirty" solution? It's got quite a learning curve to use it effectively. – Joel C Jun 02 '11 at 17:56
  • Yes it will be a lagre application, databes have 18 tables and will have to generate some documents etc. – Eduard Baraniak Jun 02 '11 at 17:57
  • 1
    Great question, Joel. I guess I've personally found it much easier to generate the EF model from the database tables, and LINQ has a very fluid, versatile syntax that I think is quite easy to use. Maybe it just fits the way my brain works. – Jeremy Sullivan Jun 02 '11 at 18:00

3 Answers3

2

"Better" depends entirely on your situation. Is the purpose to get something done as quickly as possible for internal users at your company, or is this going to be a commercial site that will need to be highly extensible and needs to be as easy as possible to maintain? Will you need to integrate with other platforms possibly built using other languages at some point? The answers to all of these questions should affect your decision.

If you're looking to separate your project into distinct layers, then I would recommend an ORM such as NHibernate or Entity Framework (there are other commercially available ORM products out there, but these are the ones I'm familiar with and which you can easily get help with on this site).

Joel C
  • 5,547
  • 1
  • 21
  • 31
  • 1
    @Eddy Add "database platform" to the list of questions... I'm not sure what support (if any) there is for Entity Framework using PostgreSQL, but I'm sure NHibernate would work. I assumed the `sql` tag referred to MS SQL Server. – Joel C Jun 02 '11 at 18:15
  • Thank you lot :) . Plese do you have some good link with ORM(NHibernate, Entity Framework) exemple for postgreSQL databes? I want try it but i do not finde any good link. – Eduard Baraniak Jun 02 '11 at 18:16
1

Create a DataSource with LINQ to Entity. It let you the liberty of LINQ with the peace of mind of when you change something il will break your build so you will be able to debug more efficiently.

Muffun
  • 726
  • 1
  • 9
  • 27
  • the real advantage of using an ORM is not having to write boilerplate data access code over and over. The "if something changes, you now have strong data typing and your program breaks" is pretty minor in the scheme of things. – Joel C Jun 02 '11 at 21:05
1

Well if you have total flexibility, I would recommend using C# ASP.NET 4 with MVC3 razor for the UI and application code. Use Entity Framework 4.1 code first for the data access layer.

This way you will always work with real objects that you create, and with List<realtype> instead of the total mess that exists with datasets.

Chris Marisic
  • 32,487
  • 24
  • 164
  • 258