# Tuesday, 04 March 2014

On a regular basis Microsoft brings out cool and easy to follow tutorials. I just noticed that the ones about Entity Framework and ASP.NET MVC got updated.

For Entity Framework the following new things in version 6 are handled:

  • Connection resiliency
  • Command interception
  • Code-based configuration
  • Async
  • Stored procedures

9 tutorials were refurbished:

And 3 new tutorials were created:

For people who’re still on older versions don’t despair, they’re still available under http://www.asp.net/mvc/tutorials/getting-started-with-ef-5-using-mvc-4

Grz, Kris.

Tuesday, 04 March 2014 12:08:00 (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Monday, 07 May 2012

Today I was trying to run a sample application for VS11 Beta that I found online: Download Hands-on Lab Source Files. However when trying to run the pages I encountered the following error:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Looking into the inner exception:

ANetworkRelatedErrorOccured

gave me the following:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified).

Ouch!

Well, what I could’ve done is trying to fiddle around with settings of SQL Server, trying to get it right and working. However I noticed that Entity Framework was being used and in the code I found this little piece:

public class ProductsContext : DbContext
{
    public ProductsContext() : base("WebFormsLab-Products")
    {
    }

    public DbSet<Category> Categories { get; set; }
        
    public DbSet<Product> Products { get; set; }
        
    public DbSet<Customer> Customers { get; set; }
}

Inherits from DbContext? Aha, that’s interesting. Now, let me see if we can get SQL Server Compact into play. Well, we can. There’s a nice Nuget package available:

PM> Install-Package EntityFramework.SqlServerCompact

This will update the web.config as well as besides downloading the package. Now running the same page again it shows the information nicely instead of giving that nasty error. Also it generated a new database file in the App_Data subfolder:

sdfcreated

Super!

Conclusion: SQL Server Compact to the rescue together with Entity Framework Code First. It’s easy to integrate via Nuget and it simply works (disclaimer: on this machine).

Grz, Kris.

Monday, 07 May 2012 20:12:44 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [1]  | 
# Tuesday, 29 November 2011

I got a new book to read: Entity Framework Code First by Julie Lerman.

It’s a rather small book but I know what I’ll be doing during the holidays soon. There are 8 chapters covered in this book:

  1. Welcome to code first: a high level and end to end overview
  2. First look at code first
  3. Using conventions for property attributes
  4. Using conventions for relationships
  5. Using conventions for database mappings
  6. Controlling database location, creation process and seed data
  7. Advanced concepts
  8. What’s coming next for code first

entityframeworkcodefirstbookcover

Grz, Kris.

Tuesday, 29 November 2011 17:40:00 (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Wednesday, 27 January 2010

From the Swiss MSDN blog:

In this 108 page hands-on lab you will learn how to use Beta 2 of Visual Studio 2010 and Beta 1 of Microsoft Silverlight 4 to create a data driven line of business style rich internet application that implements many of the new features that Silverlight 4 introduces. We will base our solution on the Windows Communication Foundation (WCF) RIA Services.

The solution will be an order-management system that shows a list of orders in a data grid and details of a selected order in a details pane. The system will validate user entries and have the capabilities of printing order reports and exporting order lists to Microsoft Excel.

Download the hands-on lab manual in PDF and Word format, the database and the final sample solution.

These features are implemented in the lab:

  • True multi-tier architecture.
  • Entity framework and service layer definition.
  • Data filtering, paging, sorting and grouping.
  • Data modification and validation.
  • Foreign key management.
  • Projections.
  • Programmatic printing from a Silverlight application.
  • COM interop with Microsoft Excel and running full-trust out-of-browser.

Silverlight4WCFRIAServicesHandsOnLab

Grz, Kris.

Wednesday, 27 January 2010 07:33:33 (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  |