Dec 052012
 

Well, the holiday season is upon us…  This usually means Christmas parties, a general drop in productivity and a gentle slide into rest and time off.  I’m going to endeavour to continue to get articles up onto the site over the holiday period.

I’ve got a box of goodies to get through, starting off with a multi-part series on claims based authentication with Active Directory Federation Services (ADFS) 2.0 and Windows Communication Foundation (WCF) services – that will be an interesting topic for those new to claims and claims based authentication (and authorisation).

Then, I’ve been getting into Windows Phone 8 development, courtesy of a webinar and the release (finally) of the Windows Phone 8 SDK and Visual Studio 2012.  So I’ll be posting more details about development and some interesting tips and tricks about the new platform.

Lastly, I’ll be reviewing UbiSoft’s latest release instalment in the Assassin’s Creed series (Assassin’s Creed III) and also writing up notes on the recently released Halo 4 on the Xbox 360.  Stay tuned for those!

So check back.. new content is always coming through the pipeline.  I’ve got the foundation article for ADFS already brewing, it requires a fair amount of up-front configuration if you plan to build a development environment which is claims aware, so I’ll try and post details as soon as possible.

Until then.. Stay safe.

R

Apr 222012
 

There’s been a bit of slowdown in composing some new articles for the site.. despite the seriously large number of things to write about. 
This year has seen SQL Server 2012 go RTM, and the early pre-release candidates for both Windows 8 and Windows 8 Server.

On the agenda are the following… please add a comment if you’d prefer some over others:

  • Team Foundation Server (TFS) Azure – Automated Builds in the cloud (continuing the series)
  • Windows 8 Server – Reviewing the new edition of Hyper-V
  • Visual Studio 11 – What you need to know
  • Windows 8 – the various editions debugged
  • What’s the latest with the .NET Entity Framework?
  • A primer on Release Management with Team Foundation Server (TFS)
  • What’s new in Team Foundation Server 2012 (Beta Edition)?
  • Career Development: Designing You, v.Next

As you can see, quite a list of meaty topics.  My time has become quite limited in the (new) world of being a Dad, so I can’t cover it all.
I really value feedback from readers, so please consider leaving a comment on what you’d like to see from the above (or suggest an alternative topic).

Best /R

Jan 282011
 

A little late, but better late than never – the Entity Framework CTP 5 was released last month before Christmas, and now that I’m back, I’ll be doing a series of posts on Code First and CTP 5.  This is mainly to test out the new Object Validation which currently only is supported by Code First architectures.

Before we get into the nitty gritty behind the most recent CTP, why don’t we stop and take a quick look at where things are with the latest release.  First off, you’ll need .Net Framework 4 and a copy of Visual Studio 2010.  Next, grab the CTP from MSDN located here.

Let’s take a look at what is new in the fifth community technical preview (CTP) – from the release notes:

What is new?

This is the list of new and improved features in CTP5:

DbContext API

  • Model-First and Database-First support:
    New T4 templates is included for using DbContext/DbSet

  • Validation of objects on SaveChanges:
    Validation is based on the use of Data Annotations and currently only supported in Code First

  • Change tracking API:
    Allows you to access information and operations applicable to objects that are tracked by a DbContext

    • Access to Original, Current & Store Values

    • Entity state (i.e. Added, Unchanged, Modified, Deleted)

    • Explicit Loading: API to load the contents of a navigation property from the database

  • Databinding:
    DbSet.Local exposes an ObservableCollection representing the local contents of the DbSet. This is particularly useful when performing databinding in WPF applications. The new ToBindingList extension method can be used to obtain a binding list for Windows Forms applications.

  • No-Tracking Queries:
    This can be achieved via the AsNoTracking extension method on IQueryable<T>.

  • DbContext Configuration:
    Allows the following options to be configured for a DbContext instance:

    • Lazy Loading

    • Validate On Save

    • Auto Detect Changes

  • Raw SQL Query/Command execution:
    Allows raw SQL queries and commands to be executed via the SqlQuery & SqlCommand methods on DbContext.Database. The results can optionally be materialized into object instances that are tracked by the DbContext via the SqlQuery method on DbSet.

  • Improved concurrency conflict resolution:
    We have added better exception messages that allow access to the affected object instance and the ability to resolve the conflict using current, original and database values

  • DbContext.ObjectContext has moved:
    Rather than being a protected member we have made the underlying ObjectContext available via an explicitly implemented interface, this allows external components to make use of the underlying context. Getting the context now looks like: ((IObjectContextAdapter)myContext).ObjectContext

  • Excluding EdmMetadata Table:
    If Code First is generating your database and you wish to exclude the EdmMetadata table, this is now done by removing a convention (note that you do no longer need to do this when mapping to an existing database).

  • Types renamed in System.Data.Entity.Database namespace:

CTP4 Name

CTP5 Name

Database

DbDatabase

RecreateDatabaseIfModelChanges

DropCreateDatabaseIfModelChanges

AlwaysRecreateDatabase

DropCreateDatabaseAlways

Code First

  • Better Code First to Existing Database Support:
    CTP5 removes the need to switch off Database Initializers when working with existing databases with Code First. If you map to an existing database that Code First did not create then it will just ‘trust you’

  • Support for additional Data Annotation attributes:
    The full list of supported attributes now encompasses:

    • KeyAttribute

    • StringLengthAttribute

    • MaxLengthAttribute

    • ConcurrencyCheckAttribute

    • RequiredAttribute

    • TimestampAttribute

    • ComplexTypeAttribute

    • ColumnAttribute (placed on a property to specify the column name, ordinal & data type)

    • TableAttribute (placed on a class to specify the table name and schema)

    • InversePropertyAttribute (placed on a navigation property to specify the property that represents the other end of a relationship)

    • ForeignKeyAttribute (placed on a navigation property to specify the property that represents the foreign key of the relationship)

    • DatabaseGeneratedAttribute (placed on a property to specify how the database generates a value for the property, i.e. Identity, Computed or None)

    • NotMappedAttribute: Placed on a property or class to exclude it from the database

  • Fluent API Improvements:

    • Simplified table and column mapping

    • Ability to ignore classes & properties

  • Pluggable Conventions:
    Based on the large amount of feedback requesting this feature we have included an early preview in CTP5. We still have some work to do on this feature but we wanted to give you the chance to provide feedback before we RTM. We’ll provide more details on this feature in the coming weeks.

Other changes

  • New Assembly Name:
    Our assembly name has changed to EntityFramework.dll

There are a bunch of exciting new changes here, most notably around DataContext and Object binding properties.  I’m going to put together a few samples using Code First over the next week or so to show you how these new changes come into play in a real world scenario.

Whilst some of this functionality is new or improved, you might notice a lot of naming changes – it is quite clear that there is a great deal of refactoring going on under the covers including renaming of the assembly file!  This would seem to indicate a number of naming changes which will create significant code changes when porting from EFv4 to EFv5 in the future.

I’ll try to keep an eye on the most widespread changes as EFv5 CTPs are evolving.  Please keep in mind that the CTP releases are not sacrosanct, and sometimes the refactoring is reversed in later releases, so don’t treat it as set in stone.. yet.