Entity Framework Vs Data Access Layer - asp.net

I want to know list of advantages of using Entity framework over data access layer.
My website is host in shared hosting and i don't have access to IIS
Considering that i am working shared hosting world, is it feasible to work with entity framework?

Microsoft has publicly stated that Entity Framework will be the preffered data access technology for the .NET platform. Given your experience I feel like Entity Framework would be a huge asset to your ability to rapidly develop applications. Shared hosting is completely irrelevant to the fact that you are using entity framework. Just make sure that the hosting company supports .Net 4 framework (or w/e framework version you work with).

Entity Framework is a data access layer. Specifically it's an Object Relational Mapper.
So it basically comes down to - do you want to write your own DAL? - or would you rather spend your time building out the Data Model, and then having Entity create your entities and classes, etc.. for you.

Related

Configure database for MVC authentication

I've been Googling terms like
configure database for mvc authentication
But I can't find anything from this decade that relates to my configuration.
I've created an MVC application using .NET Framework 4.6 with authentication support (database first). Now where do I find step-by-step instructions for creating the database tables and configuring MVC to use them?
Thanks for any tips!
The correct thing to google for is 'ASP.NET Identity'.
If you generate an MVC app straight from one of the templates it will generate a number of classes to handle security and identity.
One of these classes will implement interface IUserStore. The class provided will inherit from Microsoft.AspNet.Identity.EntityFramework.UserStore<TUser>, and uses Entity Framework to check the database if the tables exist, and create them if they are not there.
If you are uneasy about giving your application enough privileges to modify your data schema (ew!), you can create your own class that implements IUserStore and plug that into the system.
It's a big topic, but hopefully this is enough to get started with.

Difference between Entity Framework and Microsoft SQL Server

I'm fairly new to mvc, asp.net, and .net framework in general.
I understand what models are, controllers and views, but what I don't get it is Entity Framework. I developed websites before using php, and when I needed to store some data I simply do that using MySql databases. I thought this is the case with asp.net, same concept but instead of MySql, Microsoft Sql server is used. Now I started to learn .net framework and I watched a lot of online tutorials and saw them using some classes inherited from DbContext to store data! Can anyone tell me where these classes store the data and why don't we use Microsoft Sql server instead?
Entity Framework is an Object Relational Mapping tool (ORM), a layer that sits between your database and code. The idea is that the ORM is database agnostic and will handle writing the SQL for you, so that you could (in theory) swap between SQL Server, MySQL, or whatever database you want with only configuration changes.
You can skip Entity Framework and use SQL directly with ASP.Net. Your tutorials just happen to use Entity Framework.

Data Access Application Block for .NET 4.5 using MVC 4

I'm trying to develop an application using MVC 4.
Earlier I was using Generic repository for accessing my database .
But later I was suggested to use Data Access Application Block to access Data Base in my application .
I'm not getting any exact clue that how to start with it.
Can any one suggest some link which can provide me the exact information about Data Access Application blocks for .NET 4.5 and MVC 4 and also some examples of its correct usage.
Thanks in Advance..
I think Data Access Application Block is quite obsolete.
Why don't you use an ORM (such as Entity Framework or NHibernate) to build your data access layer? As you can see here Entity Framework is Microsoft’s recommended data access technology for new applications
There's quite a lot of documentation on the Pattern & Practices site at MSDN, http://msdn.microsoft.com/en-us/library/dn440726(v=pandp.60).aspx.
I have used DAAB in a few projects, but it's quite heavyweight and isn't as widely used as other frameworks. It's also very data-centric rather than being more domain oriented. You might want to consider Entity Framework or a similar ORM over DAAB.

Silverlight RIA Services with different database providers

I want to create a Rich Internet Application in Silverlight. One of the requirements is that the back-end of the application should work with different database providers (SQLServer, PostgreSQL, Oracle).
I'm planning to use Entity Data Model to represent database objects and Domain Services to expose these objects to the client.
The problem is that I don't have a clue if the same data model can be used with different database providers and how sophisticated that would be to change the provider without recreating all the model.
I want the application to be reusable on different environments, so that i can import the same database schema to any existing database, change the provider in the ASP.NET web application and that's it.
Is it doable? Or maybe there are other ways to achieve similar functionality? Thanks in advance for any suggestions.
I would like advising you to look through existing Entity Framework Best Practices

Sharing a common DAL between WPF, Silverlight, and ASP.NET

What is the best method/technology to sharing the same data access layer between WPF, Silverlight, and ASP.NET?
I am using ADO.NET Entity framework, and was thinking of a creating a DAL using the Repository pattern.Then using the RIA Services as a dummy middle man to connect Silverlight and ASP.NET. Is this a solid plan or are there other better solutions out there?
One of the solutions I like to use is the following :
- Have a project storing only the entities (for example : Player, Game, Entity) with no reference to the database at all.
- Have a project implementing the repository pattern (Repository, Repository etc...)
- Use ADO.NET Entity Framework code first approach to map with the database (it creates a dynamic child object of your entities contain in your project, see ScottGu's blog for an explanation on how to use it)
Connecting Silverlight to your pattern can be done with Ria Services or classic WCF services. Usually I try to use WCF whenever possible as Ria Services is not really compliant with an MVVM development.
If you want to use WCF and share your DAL entities with Silverlight you can create a MyDal.Silverlight Silverlight class library project and add symbolic link instead of copies of every entities you will want to share with Silverlight. Then when you'll add a service reference with visual studio it will be smart enough to not create copies off Player, Game and User to you Silverlight project.
If you want to use Ria Services it will create copies of you entities anyway.
Hope that helps
John
RIA Services
RIA services will certainly take the burden off you for all the WCF plumbing. It has a few minor flaws (lack of certain data types), but there are workarounds for most problems.
The validation model (using attribute decoration and custom validators) is very strong and a great place to hang business rules.
RIA coexists happily with ASP.Net, so that is another plus. Behind the scenes it is just another WCF service. We are happily using RIA services with MVVM and Prism.
ADO.Net EF model
This is a tried and tested feature rich model. The only problems I have found related to many-to-many relationships. Again there are workarounds.
DAL
As RIA change sets are managed for you on anything, including POCO, this is the area that will need the most attention. It is considered "bad" to expose your EF model directly to RIA and that will certainly not insulate you from data changes.
I can't specifically recommend any one pattern yet (still experimenting), but make sure your choice is compatible with IQueryable. The paging feature and appending to Linq queries for server-side execution are features you do not want to lose!

Resources