background preloader

Dev Ref

Facebook Twitter

Thanks to

ASP.NET. Using DbContext in EF 4.1 Part 4: Add/Attach and Entity States - ADO.NET Blog. The information in this post is out of date.

Using DbContext in EF 4.1 Part 4: Add/Attach and Entity States - ADO.NET Blog

Visit msdn.com/data/ef for the latest information on current and past releases of EF. For Add/Attach and Entity States see Version 4.1 of the Entity Framework contains both the Code First approach and the new DbContext API. This API provides a more productive surface for working with the Entity Framework and can be used with the Code First, Database First, and Model First approaches. This is the fourth post of a twelve part series containing collections of patterns and code fragments showing how features of the new API can be used. The posts in this series do not contain complete walkthroughs. An entity can be in one of five states as defined by the EntityState enumeration. SaveChanges does different things for entities in different states: Unchanged entities are not touched by SaveChanges.

Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application (9 of 10) The Contoso University sample web application demonstrates how to create ASP.NET MVC 4 applications using the Entity Framework 5 Code First and Visual Studio 2012.

Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application (9 of 10)

For information about the tutorial series, see the first tutorial in the series. You can start the tutorial series from the beginning or download a starter project for this chapter and start here. If you run into a problem you can’t resolve, download the completed chapter and try to reproduce your problem. You can generally find the solution to the problem by comparing your code to the completed code. For some common errors and how to solve them, see Errors and Workarounds.

In the previous tutorial you used inheritance to reduce redundant code in the Student and Instructor entity classes. The Repository and Unit of Work Patterns The repository and unit of work patterns are intended to create an abstraction layer between the data access layer and the business logic layer of an application. Creating the Student Repository Class. Getting Started with EF using MVC.

Sample

ASP.NET Data Access Content Map. MSDN Library Design Tools Development Tools and Languages Mobile and Embedded Development Online Services patterns & practices Servers and Enterprise Development Web Development ASP.NET Data Access Content Map Other Versions This topic provides links to documentation resources about how to access data in ASP.NET web applications, primarily by using the Entity Framework and SQL Server.

ASP.NET Data Access Content Map

This topic contains the following sections: ASP.NET Data Access Guidance Published - .NET Web Development and Tools Blog. On 9/11 we published a new* set of pages on MSDN offering guidance for getting started with data access in ASP.NET.

ASP.NET Data Access Guidance Published - .NET Web Development and Tools Blog

If you're already using ASP.NET, parts of these pages will just repeat what you already know or take for granted, but a few parts contain recommendations that are new for ASP.NET 4.5. These pages clearly identify which technologies are still available and supported but are no longer part of Microsoft's strategic direction, such that you should think twice before choosing them if you're creating something new.

One page provides help setting up SQL Server connection strings. Here are links to the new pages, with a sampling of what you can find in them: Integrate OpenAuth/OpenID with your existing ASP.NET application using Universal Providers - .NET Web Development and Tools Blog. Over the past couple of weeks I have come across lots of questions/discussions on while OAuth/OpenId is cool as a feature in the ASP.NET templates in Visual Studio 2012, but how do I easily integrate this into my application outside of the templates.

Integrate OpenAuth/OpenID with your existing ASP.NET application using Universal Providers - .NET Web Development and Tools Blog

More so how do I extend the Universal Providers to integrate OAuth/OpenId and use other functionality such as roles etc. I am going to cover these two areas in this post using WebForms but you could integrate the same with MVC applications as well Following are the steps of integrating OpenAuth/OpenId into your existing application I started with an empty 4.5 webapplication(yes nothing in my project except a web.config) Use Nuget to get the following packages DotNetOpenAuth.AspNet This package is the core package for OAuth/OpenID protocol communication.