יום רביעי, ספטמבר 28, 2011

Two days ago I delivered another ASP.NET MVC 3 MSDN session.As usual, we started with the basics to allow engineers not familiar with ASP.NET MVC to understand the major concepts behind it During the second part of the session, I demonstrated several subjects that are considered more advanced such as, Custom Action Result, Custom Model Binder, Custom Metadata Provider and other Custom XXXIn addition, I had the chance to introduce some really nice tools such as Knapsack and ASP.NET Mini Profiler All samples which were presented during the session can be found at my SkyDrive public folders I really enjoyed delivering this...

Source Control with SVN

יום שישי, אפריל 22, 2011

Since 2005 I've been mostly working with Microsoft Team Foundation Server to manage my source code. Before that I had the chance to work with Microsoft Source Safe and even a bit with WinCVS (for self projects) These days I am back again working on a self project and need to share my source code with two other developers. All roads led me to SVN.I was quite surprised how easily an SVN server can be installed and manipulated from Windows Explorer. So I decided to share this info with you. There are several implementations of SVN server you can use. I...

Implementing Composite Pattern with Entity Framework Code First – Part 2

יום חמישי, מרץ 17, 2011

In my previous blog post I described the way you can implement Composite pattern using Entity Framework Code First. The sample uses EFCodeFirst CTP 5 which suffers from a minor bug related to the composite relationship. Microsoft just released EF 4.1 RC which fixes the issue. Now, you can implement your composite pattern in a clean fashion. You can find the fixed composite pattern sample here.  

Implementing Composite Pattern with Entity Framework Code First

יום רביעי, מרץ 2, 2011

The full sample code can be downloaded here Entity Framework allows us to map object relationships into a database. One of the useful relationship is the Composite Pattern. Suppose we have implemented the following class diagram: As you can see this is a classical implementation of the Composite design pattern, where Group holds a collection of polymorphic items through the property Items of type BookItem. We would like to save this model into a database using Entity Framework Code First.According to ECCodeFirst coding convention guidelines we should define the following classes:public abstract class BookItem {     public int ID { get; set; }     public virtual Group Parent { get; set; }     public abstract void Accept(IBookVisitor visitor); } public class Group : BookItem {     public string Name { get; set; }     public virtual ICollection<BookItem> Items { get; set; }     public Group()     {         this.Items = new List<BookItem>();     }     public override void Accept(IBookVisitor visitor) {...} } public class Person : BookItem {     public string FirstName { get; set; }     public string LastName { get; set; }     public virtual ICollection<Address> Addresses { get; set; }     public Person()     {         this.Addresses = new List<Address>();     }     public override void Accept(IBookVisitor visitor) {...} } public class Address {     public int ID { get; set; }     public string Value { get; set; }     public string Description { get; set; }     public virtual Person Parent { get; set; }     public int PersonID { get; set; }     public void Accept(IBookVisitor visitor) {...} } public class BookContext : DbContext {     public DbSet<BookItem> Items { get; set; }     public BookContext()         : base("AddressBook")     { }     protected override void OnModelCreating(ModelBuilder model)     {         model.Entity<BookItem>().ToTable("BookItems");         model.Entity<Person>().ToTable("Persons");         model.Entity<Group>().ToTable("Groups");         model.Entity<Address>().HasRequired(a => a.Parent) ...

MSDN Session – Introducing ASP.NET MVC

יום רביעי, פברואר 23, 2011

Yesterday I delivered a nice (hopefully) MSDN session at Microsoft. During the session I presented the main features/goodies that were released during January month as part of ASP.NET MVC 3 release. The session was 4 hours long and was quite intense. During the first part of the session I built an application from scratch adding at each step a new functionality like editing capabilities, controlling access and routing system manipulation.During the second part I introduced the new features of ASP.NET MVC 3 and related technologies. Specifically I talked about: Razor syntax NuGet IIS Express Entity Framework Code First ASP.NET MVC 3 specific enhancements  Many participants...

Running with IE9 Beta and Visual Studio 2010

יום שלישי, נובמבר 23, 2010

As some of you probably noticed, there is a strange behaviour when working with IE9 beta and Visual Studio 2010 The issues I encuntered are as follow: Visual Studio might stuck (the title gets a postfix of "Not Responding") when running your application IE might stuck for a few seconds (up until 45 seconds). Only when IE resumes then Visual Studio becomes responsive again IE cannot display the web page. An error is displayed stating that "Internet Explorer cannot display the webpage" There are many posts on the internet regarding some of the issues. Most posts are refering only to issue number 3. According to  the...