Welcome to MSDN Blogs Sign in | Join | Help

ADO.NET Entity Framework Hands On Lab

Wow - I just completed the ADO.NET Entity Framework lab and this was really a useful introduction to the Entity framework.  In the lab you build a working WPF application based on the AdventureWorks database.  Not only did it help me with the Entity Framework but it also provided a useful example of how to structure the WPF application that consumes the data model.

Great job - I give this lab 5 stars - I did the whole thing in about 1 hour after resolving the issues I had from SQL 2008 - see my previous post for details on how I resolved this.

Check it out - you can find it in the .NET 3.5 Enhancements Training Kit

Posted by ronjacobs | 1 Comments

.NET Framework 3.5 Enhancements Training Kit and Getting it working with SQL 2008

Today as a part of my learning resolution I decided to run through the hands on labs for ADO.NET Entity Framework from the .NET Framework 3.5 Enhancements Training Kit.  I downloaded and installed it on an old WinXP machine and set to work on the lab.

The lab setup requires you to run a SetupEx.cmd file which among other things builds a VS Project called AliasDatabaseServer.  The point of this utility is to create a server alias for the database that you will use in the lab.  Unfortunately it failed to build.

Program.cs(23,27): error CS0234: The type or namespace name 'Management' does not exist in the namespace 'Microsoft.SqlServer' (are you missing an assembly reference?)
Program.cs(24,27): error CS0234: The type or namespace name 'Management' does not exist in the namespace 'Microsoft.SqlServer' (are you missing an assembly reference?)
Program.cs(109,40): error CS0246: The type or namespace name 'ManagedComputer' could not be found (are you missing a using directive or an assembly reference?)
Program.cs(141,40): error CS0246: The type or namespace name 'ManagedComputer' could not be found (are you missing a using directive or an assembly reference?)
Program.cs(189,64): error CS0246: The type or namespace name 'ManagedComputer' could not be found (are you missing a using directive or an assembly reference?)
Program.cs(189,24): error CS0246: The type or namespace name 'ServerAlias' could not be found (are you missing a using directive or an assembly reference?)
Done building project "AliasDatabaseServer.csproj" -- FAILED.

 

I'm sure this has to do with the move to SQL 2008 I made recently on this machine.  When I opened the project in VS I found two references to assemblies that could not be located

  • Microsoft.SqlServer.ConnectionInfo
  • Microsoft.SqlServer.Smo

To save you some time - here are the steps you need to take to fix this if you have moved to SQL Server 2008.

  1. Remove the missing assemblies
  2. Add references to the version "10.0" (SQL 2008) versions of the following assemblies
  • Microsoft.SqlServer.ConnectionInfo
  • Microsoft.SqlServer.Management.Sdk.Sfc
  • Microsoft.SqlServer.Smo
  • Microsoft.SqlServer.SqlWmiManagement

There is one other issue I found.  If you open the Tools.sln file in VS2008 it will upgrade it to the new solution file format.  This is fine but then if you try to run SetupEx.cmd again you will get the following error

.\Util\Tools.sln(2): Solution file error MSB5014: File format version is not recognized.  MSBuild can only read solution files between versions 7.0 and 9.0, inclusive.

How strange I thought until I opened SetupEx.cmd and found that it is hard coded to run the .NET 2.0 version of MSBuild which is not compatible with VS2008 solution files.

So I made the following change

Old Line: SET msbuild=%WINDIR%\Microsoft.NET\Framework\v2.0.50727\msbuild.exe

New Line: SET msbuild=msbuild.exe

Since I'm running this command from the VS2008 Command Prompt the path to the tools is already included.  Now everything works fine.

Hope that helps you to run through this very valuable content.  I may run into some other issues with the labs and I'll let you know if I do.

Ron

Posted by ronjacobs | 1 Comments

My Tech New Years Resolution

Don't you love new beginnings?  At the beginning of a year it seems anything is possible.  Perhaps that is why we feel compelled to think about how we can make 2009 a better year than last year.  I see that my last blog entry was Nov 21 which is way too long.  This year I'm going to blog more.  So here they are, my new years tech resolutions.

1. Blog more

Sometimes I don't blog because I just don't think I have something interesting to write about.  Of course, every day there is always some new thing I am learning so really I just need to take a few minutes and write it down.

2. Learn more

In 2008 I became the evangelist for WCF and WF.  This year these technologies will move into .NET 4.0 and there is a lot to learn about them.  But also I need to learn about so many other technologies

2a. Learn WPF

The new Workflow Designer is written with WPF and must be extended with WPF.  I am just getting started with WPF but I'm committed to all future demos using WPF - no more WinForms for me.

2b. Learn Silverlight

RIA applications are becoming much more important.  If I am speaking about REST at a conference I want to show REST in the context of a RIA application.  No more just plain aspx WebForms - something much better

2c. Learn ADO.NET Entity Framework

I absolutely love LINQ to SQL and I want to understand how ADO.NET Entity Framework behaves.  After all I want to write apps the way that my customers write apps.  I expect that Entity Framework will become the data access technology of choice in the future.

3. Share more

I want to share more with you.  More code, more hands on labs, more videos, more conference presentations.  I want to make these resources as useful as I possibly can so that when you are trying to get your work done you get a helping hand.  How often when I'm stuck trying to learn something new I've wondered if someone hasn't blogged about this before or if there is some sample app that can help me. In that moment I don't want to spend an hour looking for an answer, I want something quick.  Hopefully I can help you by sharing the work that I'm doing here and on ronjacobs.com

4. Listen more

Maybe this should be #1 - however order does not indicate priority.  I want to hear from you. 

  • Do you feel we are on the right track?  The wrong track with WCF and WF in .NET 4?
  • Are you building RESTful applications with .NET?  How are you building them?
  • What can I do to help you?

After all - you are the reason I am here working day in and day out.  Together we are changing the world one solution at a time. 

 

Well... that's my list.  What's on yours?

Posted by ronjacobs | 6 Comments

New WCF REST Hands On Lab Drop

Just released the November 2008 version of the WCF REST Starter Kit Hands On Lab.  This drop now includes a full lab on the REST Collection template.  With unit test coverage that demonstrates testing of a RESTful service for GET, PUT, POST and DELETE operations against the collection.

Be sure to check it out and let me know what you think!

Ron

Posted by ronjacobs | 5 Comments

Testing RESTful Services and Win7 Updates

I've been writing some tests for a new hands on lab based on the REST Collection template from the WCF REST Starter Kit.  I'm planning on using these tests in the lab to illustrate how to call a RESTful service for add, update, delete purposes.  I ran into a problem though.  The problem is that if you just run the tests, the services are not hosted by the ASP.NET development server and the tests fail.  Instead you have to Debug the solution and then run the tests.

When I asked about this on our internal unit testing forum the feedback I got was that these were not "Unit tests" but really more like "Integration tests".  I can understand why people would say this but it caused me to think more deeply about the problem.  Is there a legitimate case for "Unit testing" RESTful services?  Really the problem is no different with SOAP based web services.

Yes - you can unit test the business logic of the service separately without involving the network stack but especially when it comes to RESTful services I want to test the way the service leverages HTTP. So I will press ahead with these tests - no matter what you call them.

Does anybody know a way I can make VS start the ASP.NET development server when I run the unit tests?  I tried the ASP.NET Web testing stuff but it assumes you are testing an ASPX page so it fails.

 

Windows 7 Update

I've updated to a later build in preparation for my keynotes at the MSDN Developer Conferences in Houston, Orlando, Chicago and Atlanta.  This one has the new taskbar replacement.  It takes a bit of getting used to but it is growing on me.  At the bottom of my screen I see icons for programs like SQL Server Management Studio Express.  Visually I cannot tell if the program is running or not by looking at it (which is a little weird) but if I click the icon or hover over it I will find out.  If it isn't running, it will launch.  If it is, it will restore.  If more than one of these are running it will show me a thumbnail of the instances.

Am I still happy with Win7?  Absolutely - I'm lovin it!

Posted by ronjacobs | 1 Comments

Ready to learn more about REST with WCF?

Now that the WCF REST Starter Kit is out I'm happy to say that we have provided some great resources for learning all about it.

Aaron Skonnard has put together a terrific set of screencasts for endpoint.tv to give you a great introduction to REST with WCF and the WCF REST Starter Kit

From the PDC we have Steve Maine and Rob Bagby doing an excellent presentation

And if you want to get hands-on we have a set of hands on labs for you to try out as well.

I've just been told that my REST talk here at Tech-Ed Developers in Barcelona is so popular that they have scheduled a second session so you can take your pick.

  • SOA02-IS - RESTful Services faster, better, cheaper with the WCF REST Starter Kit
    November 11 17:00 - 18:15
    Room 131
  • SOA02-IS (R) RESTful Services faster, better, cheaper with the WCF REST Starter Kit
    November 13 13:30 - 14:45
    Room 133
Posted by ronjacobs | 2 Comments
Filed under: ,

WorkflowServices and Context Binding

While preparing for one of my Tech-Ed EMEA talks (SOA303 - Long Running Conversations in Workflow Services 3.5 and 4.0) I decided that it was important to make a point about context binding.  The point is that you don't have to use the context bindings (basicHttpContextBinding, netTcpContextBinding, wsHttpContextBinding)  if you don't have more than one receive activity.

To illustrate the point do the following

  1. Create a new VS 2008 Project (look under the WCF templates for Sequential Workflow Service Library)
  2. Drop a CodeActivity on the body of the ReceiveActivity as shown
    image
  3. Double click on the CodeActivity and add the following code

    private void codeActivity1_ExecuteCode(object sender, EventArgs e)
    {
        ReturnValue = "You entered: " + inputValue.ToString();
    }

  4. Run the app using the WCFSvcHost and WCF Test Client to test it
  5. Enter the value 1 - click on the XML tab and notice the context in the response
    image
  6. Right click on the app.config and launch the WCF config editor
  7. Expand the endpoints and on the first endpoint (not the mex endpoint) change the binding to the basicHttpBinding
    image
  8. Open the IWorkflow1.cs file and change the contract as shown below
    [ServiceContract(SessionMode=SessionMode.NotAllowed)]
    public interface IWorkflow1
  9. Now test your workflow again - this time no context and no need for the context binding as you can see from the response
    image

This is good to know since context exchange places a requirement on apps that want to send a message to your service.  As this little demonstration shows, it isn't necessary if you are using just one receive activity to create your workflow service.

Posted by ronjacobs | 1 Comments

Windows 7 - Day 7

I'm now 1 week into my Windows 7 adventure.  I've had a few crashes here and there but far less than one would expect from something labeled "Pre-Alpha".  I am on my second installation however because I did relent and setup multi-boot on my system with a Vista partition as a backup.

Tomorrow I leave for Barcelona where I will be presenting at Tech-Ed Developers Europe.  Some of my presentations will require that I run the "Oslo" VPC from PDC.  Right now I can't run Virtual PC 2007 on Windows 7.  I did find out that I can attach the VHD and event boot from a VHD but I cannot boot a Windows Server 2008 VHD (which is what the "Oslo" VPC is based on.  You can only boot Windows 7 or Windows Server 2008 R2 VHDs.  This is going to be a very, very cool feature in the future.  I'm quite sure that I will use it a lot once we move more into Windows 7 and Windows Server 2008 R2.

On Wednesday I faced the moment of truth... Would I give up on Windows 7 and go back to Vista or find a way to stay with Windows 7?  Honestly unless I found Windows 7 compelling I would have just gone back to Vista but even with the inconvenience of multi-booting I just had to stick with Windows 7.  This is a very good sign for the future of Windows 7.  So the other day I rebuilt my machine with a small Windows Vista partition just for the purposes of running old VPCs.  Other than that I am happily moving forward.

I'm even taking a chance and installing Far Cry 2 on Window 7 as well - it works great.  One interesting surprise about Far Cry 2... it installed .Net Framework 2.0 on my machine during setup.  Interesting....  Perhaps some managed C++ in the game?

Posted by ronjacobs | 3 Comments

Windows 7 - Day 3

So far I have to say that I'm pleasantly surprised at the speed and stability of Windows 7.   It is much faster at most things.  One thing that really used to annoy me with both WinXp and Windows Vista was how long it took to display a context menu when I right clicked on a file.  It is much, much faster on Windows 7.  I've had no serious crashes and no app compatibility issues with apps I've installed on it thus far.

Today I'm diving into development so installing Visual Studio 2008 and it went off without a hitch.  I have to say things are looking good for Windows 7 so far.

Posted by ronjacobs | 1 Comments

Windows 7 Here We Come!

I'm writing this blog entry on a newly installed pre-Alpha version of Windows 7.  I know... am I crazy?  I installed Windows 7 on my main laptop.  Well... we shall see.  After getting a glimpse of Windows 7 at the PDC and some hallway conversations here in Redmond where the word was that Windows 7 was incredibly stable for this stage of the game. 

I have to say - so far so good.  I've installed a few apps and drivers with no problems at all.  The performance seems quite good.

I promise to give an unbiased opinion of my experiences to you over the next few days as I prepare to head to Tech-Ed Europe in Barcelona next Friday.

Posted by ronjacobs | 1 Comments

More Video on the WCF REST Starter Kit

I recently recorded some video podcasts for the OnMicrosoft podcast series.  If you want to hear more about the WCF REST Starter Kit or listen in to Matt Winkler and I discussing workflow and the WCF 3.5 Unleashed book check these out.

Inside the WCF REST Starter Kit CodePlex (video)

WCF and Windows Workflow in .NET 4.0 (video)

Windows Communication Foundation 3.5 Unleashed (video)

Posted by ronjacobs | 1 Comments

WF 4.0: A First Look at Microsoft PDC 2008

This week we are finally taking the wraps off of Workflow 4.0 and Monday we had a great talk from Kenny Wolf introducing Workflow 4.0.  The great news is that it is already live on Channel 9 along with some other episodes of endpoint.tv where I asked some workflow experts about what they thought of Workflow 4.0.  Also if you want to take a look at Visual Studio 2010 in action you can view a PDC Hands On Lab Cast to see a screencast of the lab in action.

Must see endpoint.tv

WF 4.0: A First Look (PDC Session with WF Architect Kenny Wolf)
endpoint.tv - WCF and WF 4.0 First Look with Zoiner Tejada
endpoint.tv - WCF and WF 4.0 First Look with Scott Golightly
endpoint.tv - WCF and WF 4.0 First Look with Brian Loesgen

PDC Hands On Lab Casts

endpoint.tv - PDC Hands On Lab Cast - Lab 1 - Introduction to Workflow 4.0
endpoint.tv - PDC Hands On Lab Cast - Lab 2 - Custom Activities
endpoint.tv - PDC Hands On Lab Cast - Lab 5 - Introduction to Workflow Services
endpoint.tv - PDC Hands On Lab Cast - Lab 6 - Deploy and Manage Workflow Services

WCF REST Starter Kit

The word is getting out and hundreds have already downloaded the WCF REST Starter Kit.  Have you?  Jesus Rodiguez has and he wrote an excellent post on caching your RESTful services.  If you want to learn more be sure to try out the WCF REST Starter Kit Hands On Labs which includes a caching lab.

Posted by ronjacobs | 4 Comments

WCF REST Starter Kit

The big day is finally here - the release of the WCF REST Starter Kit.  A few months ago when I first started learning about REST with WCF I found it was possible to build RESTful services with WCF but it wasn't easy.  I started working with the WCF team on some ideas to make the process better and instead of waiting for .NET 4.0 to deliver these ideas they decided to make them available now.

Moments ago the starter kit was released on the web.  Here are some important links for you.

WCF REST Starter Kit Project on Codeplex

WCF REST Starter Kit Hands On Labs at MSDN Code Galllery

WCF REST Page on MSDN

Posted by ronjacobs | 1 Comments

Clean that Project

Have you ever noticed that when you tell VS to "Clean" it doesn't really clean?  I don't know what it actually does but after a clean I still see bin and obj folders under my project.  When I want to share code with people I usually want to get rid of those folders as well as old test results created by unit tests.  I got fed up with having to manually remove these things so I wrote this nifty little tool that will recursively clean a directory tree.  Give it a try

Posted by ronjacobs | 3 Comments

Building A Better Sample Application

Lately I've been working with the product teams on building new things that will be revealed at PDC 2008 (you are going aren't you?)  such as WCF and WF in .NET 4.0 and "Dublin".  I'll have many more details on this to come but today I want to think about sample applications.  If you are like me you probably look to samples to find all kinds of useful nuggets about how to do something.  I have some ideas on how to make a great sample but I'd like to know what you think.

Here is my list

Make It Focused

The sample ought to focus on a few things, not everything.  I don't have all day to study the code.  I want to pick up a specific technique or method for doing something.  I understand if you don't supply enterprise class error handling, security or monitoring to the code.  It's a sample after all - I'll pick those things up somewhere else. 

Make It Work

When I open the project and hit F5 it should do something cool.  Don't make me do 5 things before it will do something cool.  Don't have it just sit there not doing anything either and don't make me read a doc to figure out what to do.  Most of the time if there is a readme.txt I don't read it.  It's not that I don't want to it's just that I'm busy and I'm trying to get right to the point.

Make It Easy To Understand What Matters

Some samples contain a lot of code.  Much of it is boilerplate generated code or scaffolding code that really doesn't matter much for the purposes of this sample.  Here is a test.  In 5 minutes or less I should be able to open the solution, run the app and answer the following questions.

  1. What is the main point of this sample?
  2. Where is the code that demonstrates it?
  3. How does it work?
  4. Why should I care?

Why This Matters

Product teams spend months (and sometimes years) working on a feature to fine tune its implementation.  This is great, I'm glad they do it.  However you also have to consider closing the gap between a great implementation and the odds of an average developer being able to understand how to and why they should use it.   After spending so much time with your feature set these questions  seems obvious to the team that built them but you and I know differently.

What do you think?  What makes a great sample? 

Have you seen a great one?  What is it?  Why was it great?

I'm putting together my list and I really want to add your feedback to it so sound off and let's get some great samples.

Posted by ronjacobs | 5 Comments
More Posts Next page »
 
Page view tracker