Dane Morgridge

Programmer, Geek, ASPInsider
A blog about code and data access

  Home  |   Contact  |   Syndication    |   Login
  44 Posts | 0 Stories | 67 Comments | 0 Trackbacks

News

INETA Community Speakers Program

Twitter












Archives

Post Categories

December 2010 Entries

There are several attributes available when using code first with the Entity Framework 4 CTP5 Code First option. When working with strings you can use [MaxLength(length)] to control the length and [Required] will work on all properties. But there are a few things missing. By default all string will be created using unicode so you will get nvarchar instead of varchar. You can change this using the fluent API or you can create an attribute to make the change. If you have a lot of properties, the attribute ......

I have been using EF4 CTP5 with code first and I really like the new code. One issue I was having however, was cascading deletes is on by default. This may come as a surprise as using Entity Framework with anything but code first, this is not the case. I ran into an exception with some one-to-many relationships I had: Introducing FOREIGN KEY constraint 'ProjectAuthorization_UserP... on table 'ProjectAuthorizations' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON ......