Is DAL class required for database connection?

Asked

Viewed 454 times

0

Is it necessary to create a file for a database connection? According to a teacher of a colleague of mine it is necessary to have this DAL class to make the connection with the bank. But the book I’m basing myself on says nothing. The archive mdf is not responsible for this?

  • 2

    I do not know if it is easy to answer without having more data. But in principle DAL is not necessary to connect to the databank. But that teacher might be talking about something else that your friend didn’t understand, and he passed something else on to you that understood a third one. It may be a wireless phone problem. The file mdf is something for the database to store the data it needs, in principle it does not matter for your application. Unless you’re talking about something else that’s not clear.

1 answer

2


It is necessary to create a file for database connection?

No. The context + the connection strings defined in your file Web.config are already doing that.

The archive mdf is not responsible for this?

MDF (Master Data File) is a complete database, not a DAL. It is used when there is no database server installed on your machine, but is quite limited and not recommended for extensive application development.

  • You could give an example of when to use DAL?

  • 2

    You use DAL when you need to define the data access layer in detail. If your system uses some data access framework like the Entity Framework or nhibernate, this is not necessary because these Frameworks already have a data access logic ready.

  • Thank you. Now it’s clearer. In this case, if I develop a project without any access framework, I should use DAL, right? In my case I’m developing the final project of the college, I believe that the mdf can meet my needs, right?

  • 1

    @Ryansantos I believe so, although I do not like to work with him very much. It is very susceptible to failures.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.