nativegrip
nativegrip

Reputation: 892

Which is the more suitable approach for database support in Website? "Class Library" or "Web API"

I plan to build website using asp.net mvc 5. But can't use databse direct in application as per my criteria. So now i have two ways, either use Web API or Class Library for database operation. Note that this website will have to many forms and have lots of database operations.

Please help me to get best decision. Thanks in advance.

Upvotes: 0

Views: 33

Answers (1)

Kelso Sharp
Kelso Sharp

Reputation: 972

Create a second class library project in your solution, you would still need to do this even if you use WebAPI, encapsulate your database access code in the class library and reference it from your application project. This is encapsulation 101, look up repository pattern.

Upvotes: 1

Related Questions