Monthly Archives: August 2007

links for 2007-08-29

Advertisements

ADO.NET Team Releases Entity Framework Beta 2 & the 1st Entity Framework Tools CTP

Microsoft has released the Entity Framework beta 2 and the 1st beta of the Entity Framework Tools CTP today.

This is great news for those developers using Visual Studio 2008 Beta 2 and want to get serious with the Entity Framework and more importantly the Framework Tools.

From the ADO.NET team blog, the Beta 2 includes new features of the June CTP:

Beta 2 of the Entity Framework includes many great improvements and added features since the last release of the June CTP, including:

  • Events to customize code generation
  • Abstract types in EDM models
  • Complex types
  • <Using> support in metadata files
  • Entity key serialization
  • Increased persistence ignorance in entity data classes
  • Improved connection management in ObjectContext
  • Improved DataBinding usability
  • Metadata annotations
  • Better support for span over LINQ to Entities queries
  • Improvements to LINQ queries: additional canonical functions and automatic mapping from CLR functions to server functions
  • A new event for extensibility of SaveChanges
  • Usability and consistency improvements
  • Polymorphic results from stored procedures

My personal excitement is with the tools being released from the team.  From the ADO.NET blog, the tools include:

Entity Designer

  • Generate a model from a database (via wizard) and display it on the designer surface
  • Edit conceptual model properties (namespace, alias, etc.)
  • Control visual aspects of the design surface (layout) and persist changes
  • Add, Delete, and Edit Entities; Scalar properties; Associations; and Inheritance
  • Automatic set management
  • Automatic Navigation property management
  • Error reporting
  • Validate model and mappings using Entity Framework Runtime

Entity Mapping

  • View the mapping for a C-Side Entity or Association
  • Rename or delete C-Side objects without  worrying about mapping
  • Map an EntityType to multiple tables
  • Apply multiple conditions to a table mapping
  • Map associations
  • Automatic generation of conditions and referential constraints on associations
  • TPH: Map an Entity hierarchy to a single table
  • TPT: Map an Entity hierarchy to multiple tables

Entity Model Browser

  • Understand and visualize the model in a tree hierarchy
  • Visually relate shapes on the designer surface with hierarchy in model

Visual Studio Integration

  • Support for C# and VB in multiple project types: ASP.NET Web site, ASP.NET Web Application Project, Console, WinForms, and Library
  • Project system integration: item template for .edmx file, model generation wizard, EdmxDeploy.exe, and Entity Framework validation on build
  • Support for multiple Visual Studio editions: Express, Standard, Pro, and VSTS.

The team also announced a set of samples which should help out quite a bit as well.  I am looking forward to see how the tools stack up against some of my OR/M favorites.

InfoQ – My Second Article Posted

Since signing on with InfoQ as a .NET editor I have had my second article posted.

I had the great opportunity to chat with Eric J. Smith of CodeSmith Tools, LLC to talk about their PLINQO templates that enhance Microsoft’s LINQ to SQL.  These templates are an add-on to CodeSmith, which is a great code generation tool.

Please check out the article.

Technorati Tags: , ,

links for 2007-08-24

Julie Lerman Blog – Add great searching to your ASP.NET website for a nominal cost and support the American Diabetes Association

Here is a great reason to spend a couple dollars today for a great cause and put a nice search engine on your ASP.NET site.   Go check out Julie Lerman’s site for the details.

Technorati Tags: , ,

Microsoft SQL Server 2005 Replication Automation Resources for SQL Management Objects (SMO)

Background

I have recently been involved in a project which makes heavy use of Microsoft SQL Server 2005.  We have many database servers all over the company including several clusters with locations all over the world.

My role on the project is to be able to synchronize all of the databases across the company so each database has the same information in it as close to real-time as we can.  I decided to use SQL Replication Services in a transactional push configuration.    I used this method in a test environment and found the performance to be very good and the results very reliable.

Setting up SQL Server Replication is pretty straight forward using SQL Management Studio as the wizards guide you through the entire configuration.  I had about 100 tables that needed to be replicated out of about 250 tables, selecting them was where it became a bit time consuming but setup was still easy.

The Challenge

The replication solution was to run in a development environment during the later parts of system development so we could see the behavior of replication from both a performance and latency standpoint.  The results were extremely fast even across the Atlantic Ocean, we are talking milliseconds here for changes to data.

The challenge we faced came about when we needed to make schema changes on the server who was the replication source (publisher).  The process we use is to compare the old schema to our new schema and generate a SQL script to execute on the replication source database.  Prior to using replication we had no trouble performing this task but with replication running there is a problem when changing an existing column in a table, SQL Server will NOT allow it.  The issue stems from the fact that SQL Server drops the column and re-creates the column with the changes, which cannot happen to replicated tables.

The Solution

So, the way I approached this problem was to be able to easily remove replicated tables from a publisher, make schema changes and re-create the replication.  This is a straight-forward but tedious task using SQL Management Studio but is error-prone and tedious.

I started looking at using SQL Management Objects (SMO), which I had used on another project for automating other SQL tasks.  I discovered SMO has a subset of classes call Replication Management Objects (RMO) that are designed just for this task.  The only problem I faced was learning how to use them in a timely manner and be able to write the code to do all that was needed.

The key part to learning to use RMO is to learn how SQL Server Replication is designed and how it works.  Once this is understood, it is pretty easy to see how RMO maps to how SQL implements replication. 

It took a bit of effort to find the right resources on the web to learn how RMO works and locate the resources to turn to if I had a question.  The main point of this post is not what I did but more of the resources I used to build my solution.

The Resources

Most of the information I found and used was directly from Microsoft’s MSDN web site but provided here to help group them together.

Transactional Replication Overview – learn what it is all about.

Configuring Replication (RMO Programming) – probably the best resource for writing an RMO application based on C# or VB.NET.

Microsoft SQL Server Replication Forums – good to read about those who have done it and get answers relatively fast.

MSDN Magazine Article – great way to get started.

Making Schema Changes on Publication Databases – what you need to understand.

The tool I use for comparing databases is SQL Compare from Red Gate Software.   This tool is great, easy to use and allows the user to save it’s results in a SQL script.  Red Gate has released SQL Toolkit which allows for managing replication and some other things.  I have not looked extensively at this product but it may wrap RMO and make it a bit easier to automate your RMO tasks.

All in all RMO is a great way to programmatically manage replication in your application.  It does have a bit of a learning curve, as does any new technology, but once over the curve it works really well. 

Technorati Tags: , ,

Public Hotfix Patch Available for VS 2005 F5 Debugging Performance Issue with ASP.NET – ScottGu’s Blog

Scott Guthrie posted about a hotfix available for VS 2005 to fix a performance issue when debugging ASP.NET applications by pressing F5 to start debugging.

This has been one of my pet peeves using ASP.NET debugging, the startup time is horrible.  I originally thought it was some of the third-party controls I used and when I couldn’t fix it, just assumed I would have to live with it.  This has been over 3 years of use.

I hadn’t realized this was a known bug by Microsoft and finding this information today is like found money.  Yes, I am very happy indeed.