XML to Serializable Class in Visual Studio.

Keywords: XSD.EXE, SVCUtil, XSD2Code

I have found that this is easier than using the xsd.exe tools, though I am sure the Visual Studio “Create Schema” may be calling some base class that was used by xsd.exe.


To supress warnings:
#pragma warning disable 0169, 0414, 0472
#pragma warning disable 0169, 0414, 0472
Share on Facebook

OData – EF 4.2 Speech November 8th at the Veredus Building near Lenox Mall

There will be enough differences, since I will be removing the MVC4 – EF 4.2 Code first code out and replacing with Silverlight OData Client.

Share on Facebook

IEnumerable trick saving a ToList()

public static class IEnumerableExtensions
public static void ForEach( this IEnumerable list , Action action)
foreach (T item in list)

Thank you Douglas Marsh!

Share on Facebook

Sixth Sense Wiki – Hardware.. woohoo


Share on Facebook

Entity Framework 4.1 / 4.2 work arounds.

Keywords: Entity Framework not updating, Entity Framework not inserting,  Entity Framework not deleting.  When the default code doesn’t seem to do it for you there are a few work arounds you can try ot get connected with your DBContext or extended DBContext if using Code First.
* Make sure that you have the connection string in each app.config/web.config of every project you are using.
If you are using Code First, find your Context class and add a default contrustructor and one that takes a connection string like so: (From my OData / EF 4.2 /MVC 4 Demo)

public class OrderSystemContext : DbContext


//New Constructor Calling DBContext(connstring)

public OrderSystemContext(string connString) : base(connString){}

//Need to add a base constructor since you have a constructor with parameters.

public OrderSystemContext() : base(){}

publicDbSet<StateInfo> States { get; set; }

publicDbSet<Order> Orders { get; set; }

publicDbSet<Coupon> Coupons { get; set; }

publicDbSet<Promotion> Promotions { get; set; }

publicDbSet<Product> Products { get; set; }

publicDbSet<Customer> Customers { get; set; }

publicDbSet<Location> Locations { get; set; }

publicDbSet<ProductSet> ProductSets { get; set; }


Then you can directly call the connection string directly.

//This is calling the string by name, by default the “DefaultConnection” should work if places as a connection string name and you pass no parameters.  Though it did not in my case.

using (var db = new OrderSystemContext(“DefaultConnection”))



<add name=DefaultConnectionconnectionString=Data Source=.;InitialCatalog=CodeFirst;Integrated Security=True;User Instance=True;MultipleActiveResultSets=TrueproviderName=System.Data.SqlClient />


If you are using Data First then you can just use the

using (var db = new MyEntities(System.Configuration.ConfigurationManager.ConnectionStrings[“MyEntities”].ConnectionString))

Connection String:

<add name=WGEEntitiesconnectionString=metadata=res://*/DataFirst.csdl|res://*/DataFirst.ssdl|res://*/DataFirst.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=WGE;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;providerName=System.Data.EntityClient />

Where you will use the class that is decorated in the .cs under the self tracking entities .TT file  and will be extended from DbContext or ObjectContext like so:

public partial class MyEntities : ObjectContext

This should force the connection.


I am unsure why I am having to do this work around, however it has helped others so I figured it was worth a post.

Share on Facebook

MIcrosoft Joins the Sixth Sense race with Omnitouch.


Share on Facebook

Sixth Sense to run on Windows OS.

So I’ve been checking out more and more TED videos and came across a the most wonderful innovation I have seen in a very long time called Sixth Sense. it is a device you can wear, it knows where your body is and fingers etc. You use yoru body as the controller rather than a mouse or a button and you can use any surface as a monitor.

This is my new after-hours coding home.
C#/C++ Code Base.
svn checkout http://sixthsense.googlecode.com/svn/trunk/ sixthsense-read-only

Share on Facebook

Speaking on ODATA, EF 4.1 Thursday at the Microsoft Building. – Mark Rowe


We will cover EF 4.0, changes to 4.1., and the fix that resulted in 4.2

What problems are solved?
ObjectContext, DBContext.
Code First, DataFirst
Data Annotations (viewed through MVC4)

Current Web Service Layers
Customizing Post and Gets
Query Interceptors
Change Interceptors

Share on Facebook