# Monday, August 18, 2008

You have heard a lot about the ADO.NET Entity Framework over the last few weeks. What you may not have heard about is just how easy the EF makes it to expose your data as a cloud service in ATOM format over the REST protocol. I'll show you just how easy it is to do here.

First open Visual Studio 2008 with SP 1 installed. The EF and "Astoria" (or ADO .NET Data Services) both ship with SP1.

Choose File|New Project and choose ASP .NET 3.5. Name the project NorthwindTestService and hit ok.


Go ahead and delete the Default.aspx file and right click on the project and click on "Add->New Item". Highlight "ADO.NET Entity Data Model" and name your model Northwind (or something similar) and click ADD.


This brings you to the Entity Framework wizard. Choose to work from an existing database and put in the connection for Northwind (or create it if it does not exist already) and click through the wizard until it brings you to the Choose Your Database Objects dialog. Choose Customers, Orders, and OrderDetails and click finish.


OO experts will tell you to rename your objects (to be singular, not plural for starters), but let's leave them the same for now. Next step is to right click on the project and select Add->New Item and select "ADO .NET Data Service."

Give your service a name of NorthwindTestsercvice or something like that. Then Click ADD.


The NorthwindTestService.svc,cs file should be open and you have to make two modifications to get your data exposed. There are tons of modifications you can make around permissions and what data to expose, but for now let's just get up and running and expose everything. You need to name your DataService, give it the name of your Entity Diagram that you build in the wizard, in our case it is NorthwindEntities. (By default the wizard names it DatabasenameEntities.) Then add one line of code to set the access for everything in your model ("*") and giving it read access. (If you make this .All then users can read and write.)

namespace NorthwindTestService
    public class NorthwindTestService : DataService< NorthwindEntities>
        // This method is called only once to initialize service-wide policies.
        public static void InitializeService(IDataServiceConfiguration config)
         config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);

Now hit F5. (You may have to turn off IE 6/7 or FireFox's Auto RSS reader off)

The URL should be something like this (maybe a different port):

And you should see XML in ATOM format like this:

- <collection href="Customers">
- <collection href="Order_Details">
- <collection href="Orders">

Now the fun starts. Let's look at the customers:


You will see a list in ATOM format of all the customers in your Customers table. Now look at just one customer:


Now all the orders for that customer (careful it is case sensitive):


Now one order:


You get the idea. You can even filter inside of the URI with some rudimentary WHERE clauses.

Now you can also bind this data via client side JavaScript to a GridView, a SilverLight Grid, or a 3rd party control like Telerik's RAD Grid.

posted on Monday, August 18, 2008 4:10:17 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [2] Trackback
# Friday, August 1, 2008

One month from today I leave for my 4th trip to Nepal and my second trip to Mt. Everest Base Camp. I am the expedition leader (wow!) and we will climb up Kala Pattar (19,000') in route. I helped raise money for charity on this trip (over $12,000 raised for computers for inner city schools) and will be blogging about the trip for the kids from Nepal.

I am off for a week of training in South America at altitude (and some R&R too). Back blogging in mid-August. Stay tuned...

posted on Friday, August 1, 2008 8:25:49 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [1] Trackback
# Sunday, July 27, 2008

This week is the meeting of the Data Programmability Group's Advisory Council. I'll be headed out to Seattle to participate in a conversation with the Data Programmability team on the next version of Microsoft's data access strategy, including the Entity Framework.

Roger Jennings today pointed out that my dismissal of ORM in general led him to wonder why I was chosen for the Data Programmability Group's Advisory Council. My pal Julie Lerman emailed me a few months ago asking "I did not know you were a DDD guy?"

I was glad that Danny Simmons asked me to be on the council since I have participated on several data access councils at Microsoft over the years (Including one with Roger Jennings about 11 years ago.) I've watched Microsoft move from ODBC, DAO, RDO, ODBCDirect, OLE DB, ADO.NET and now to a more conceptual model.

Sure I am not a true DDD guy and I do tend to dismiss ORM in general, so my views will insert a different view point into the conversation. Why have a council that is all the same? The whole point of this conversation is to have a dialog and listen to each other (and learn from each other.) By discussing our use cases with Microsoft, we can help them make better design decisions, and refine our own views. Anything else is just dogma.

posted on Sunday, July 27, 2008 10:35:40 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Saturday, July 19, 2008

We had our first (annual?) speaker idol contest at our user group this week and it went great. I was a judge in a few of the Tech*Ed speaker idols in the past so I knew the ropes and just followed what the pros did at our user group. I did not realize, but that experience really made a difference since ours went off with out any major problems.

Mark Feedman who runs a few (awesome) User Groups up in Stamford, CT was at our meeting and took great notes since he wants to do it at his groups. He came up with a valuable resource for User Groups (and Speakers) wanting to do this event. Read it here.

posted on Saturday, July 19, 2008 12:49:58 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Friday, July 18, 2008

Thursday, July 31, 2008
Special Meeting:
.NET Framework Team Presents VS'08/.NET Framework 3.5 Service Pack 1

You must register at https://www.clicktoattend.com/invitation.aspx?code=130081 in order to be admitted to the building and attend.
***There is a limit of 100 attendees so register now!***

This is a special treat! The .NET Framework team, in town to brief the press on the impending release of SP1, will pay a visit to us and brief us as well.
Key topics to be presented include improvements for building Web 2.0 apps, specifically focusing on ASP.NET Dynamic Data, and additions to ASP.NET AJAX (which now provides support for managing browser history), and ADO.NET Data Services. Also discussed will be The Entity Framework/Entity Data Model and improvements to WPF.
Please note: this meeting will be held in the "Radio City" conference room and not our usual location of the Central Park multi-purpose room.

Shanku Niyogi, Microsoft
Shanku Niyogi is Product Unit Manager for the .NET Framework at Microsoft. Shanku is a direct report of Scott Guthrie, Corporate Vice President, .NET Developer Division.

Thursday, July 31, 2008

Reception 6:00 PM , Program 6:15 PM

Microsoft , 1290 Avenue of the Americas (the AXA building - bet. 51st/52nd Sts.) , 6th floor

B/D/F/V to 47th-50th Sts./Rockefeller Ctr
1 to 50th St./Bway
N/R/W to 49th St./7th Ave.

posted on Friday, July 18, 2008 11:34:34 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Tuesday, July 15, 2008

My view of FireFox 3.0, about 10 times a day.  Still waiting for a service pack...

posted on Tuesday, July 15, 2008 10:54:18 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Monday, July 14, 2008

Thursday, July 17, 2008
"Speaker Idol" Competition

You must register at https://www.clicktoattend.com/invitation.aspx?code=129952 to be admitted to the building
Five technical presentations, with a panel of judges including Mary Jo Foley
1. Zino Lee: Introduction to F#
We will see what F# is and what features/differences there are between F# and "imperative" languages like C#
2. James Curran: Castle Monorail
MonoRail is a MVC framework for Web Development inspired by ActionPack. It is part of the large Castle Project which includes the Windsor IoC container and the ActiveRecord data mapper.
3. John Carnevale: Upgrading Legacy Code
Learn how to read the code and determine a path of action to be taken with the code upgrade. See how to evaluate what could be upgraded, what to rewrite and when to start all over from scratch.
4. Bill Fugina: Arithmetic in Generic Classes
Bill will show some examples of the benefits of doing arithmetic in generic classes and some utility classes and interfaces that make it extremely easy to do so
5. Gerardo Arevalo: Casual and More Hard-Core WCF
In his demonstration, Gerard is going to quickly build a pair of WCF client applications to demonstrate the use of the MVP design pattern to guarantee a contract with the clients and facilitate unit testing

Zino Lee has been working on wall street investment banks for the past 12 years, and doing .NET for 4 years. Currently the VP and manage a group that takes care of all GUI work for a trading desk. In graduate school at NYU James did some OCaml work when F# project started.
James M. Curran is a Senior Developer at BarnesAndNoble.com and as a hobby, the Owner/Operator of NJTheater.com which is being converted into a MonoRail based site (under-development version viewable at www.njtheater.org). Previously, he was a Microsoft MVP for VisualC++.
John Carnevale is working at Purvis systems stationed at the FDNY converting legacy code to .NET for the Starfire system.
Bill Fugina works as a software developer for Coleman Insights, a music industry market research company in Research Triangle Park, North Carolina. He visits the office three or four days each month and otherwise telecommutes from his home office in Windsor Terrace, Brooklyn.
Gerardo Arevalo is relatively new to the New York (Tri-State) area. He is from El Salvador, lived in North Florida, then packed up for the North East to be closer to the techno

Thursday, July 17, 2008

Reception 6:00 PM , Program 6:15 PM

Microsoft , 1290 Avenue of the Americas (the AXA building - bet. 51st/52nd Sts.) , 6th floor

B/D/F/V to 47th-50th Sts./Rockefeller Ctr
1 to 50th St./Bway
N/R/W to 49th St./7th Ave.

posted on Monday, July 14, 2008 2:43:50 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Friday, July 11, 2008

I know this is a technology blog (sort of). But those of you who know me, know that I have an unhealthy obsession with the New York Mets. Why would I say I would visit Yankee Stadium, the home of the enemy?

Yes I root against the Yankees on most occasions, however, I am a baseball fan. The "House that Ruth Built" has a lot of baseball history. Yankee Stadium is being torn down at the end of this year in favor of a new stadium so I had to visit one last time. (My last time there was with Andrew Brust and some Microsofties about 6 years ago, last time before that was in the early 1980s.)

But going to Yankee stadium would involve one big problem: I would have to watch a Yankees game. (I don't watch Mets-Yankees games, I get too nervous. The Mets can go 6-156 for the season, but if those 6 wins are against the Yanks, it is a good season.)

Then last year, Major League Baseball announced the All Star Game was to be played at Yankee Stadium in honor of its closing. Last time an All Star Game was in New York was 1977, and I was only 5, so I could not afford to scalp tickets on stub hub. (Oh wait, Al Gore had not invented the internet yet.) I have wanted to go to the All Star Game since I was about 5, so a life long dream is to go. (Along with both the summer and winter Olympics. Already have plans for Vancouver 2010 and working on London 2012.)

Going to the All Star Game at Yankee Stadium would accomplish two things: complete a lifelong goal of going to the All Star Game and going to Yankee Stadium one last time in its last season (with the added bonus to not have to watch the Yankees!)

By the magic of stubhub, I bought four tickets.  They arrived today. The game is on Tuesday, no rain in the forecast.


PS The Mets are slated to host the 2011 All Star Game at their new park, Citi Field. Maybe I will get to go to 2 All Star Games...

posted on Friday, July 11, 2008 11:13:28 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Sunday, July 6, 2008

The boys over at Desktop Alert are headed to Iraq on Wednesday to install their life saving mass communication software at US Military bases in Baghdad and Tikrit. Howard, the founder of Desktop Alert, was humbled when chosen for this assignment. I met Howard five years ago while teaching a class on .NET at CUNY in Manhattan-and he is as crazy as I am, so we hit it off. Since then I have acted as a business and technical advisor to Desktop alert and most recently architected the latest version of their software about six months ago. (Massively distributive application, right up my alley.)

To have played a small role in the success of Desktop Alert and to contribute in helping our brave men and women in uniform-and in the line of fire-is overwhelming. Having lost someone very dear in Iraq three years ago makes this even more special.

Good luck and godspeed Howard and team. I'm so proud of you.

posted on Sunday, July 6, 2008 6:41:42 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback