Rants Tagged with “.NET”

<<  <  1  2  3  4  5  6  7  8  9  10  11  +  >  >>  (Total Pages: 17/Total Results: 165)

Atlanta MSDN Event - Astoria and Silverlight

Come see me and Glen Gordon talk at Phipps Plaza in Atlanta about Visual Studio 2008, "Astoria", Entity Framework and Silverlight...and see them working gracefully together!

Click here to register for the event before it fills up.

Persistence Ignorance in Entity Framework

Danny Simmons digs into some of the confusion about the different ways to handle persistence ignorance in the Entity Framework. While I understand the attempt to fit in with the DDD guys and in some ways compete with NHibernate, I like that the persistence story isn't coddling to one side or the other...so you can have smart or stupid objects...your choice.  Its worth a read if you want to see where this is going (and how its the polar opposite of the LINQ to SQL story).

Polymorphic Entity Framework Designer Example

I've been digging into the latest version of the Entity Framework Beta (and designer CTP) that dropped a few days ago. I've concocted a small example that shows the derivation model in the Entity Framework. Essentially it is a small model that has a Product type and two types that derive from that: ActiveProduct and DiscontinuedProduct:

Figure 1

Figure 1: Simple Model

The new design tools are pretty basic but interesting nonetheless. They seem to be modeled after the LINQ designer (which doesn't make me excited).  The designer has a surface to draw types (or they can be created from database metadata) and create relationships between types (as seen in figure 1 above).  In addition, there are two information panes: Entity Model Browser and Entity Mapping Details:

Figure 2

Figure 2: The complete Designer Experience (Click image for full size)

The idea of this simple model is to show how you can specify derived types in the designer. The derivation in our case evolves around the Discontinued field in the Products table in the Northwind database. The way that different types are typed in the model is using Conditions.  In our case we are typing the database data as a Product if the Discontinued field is NULL (which should never happen really, but the designer doesn't seem to support the notion of an abstract type yet); if the Discontinued field is true (or 1) then its a DiscontinuedProduct type; and if the Discontinued  field is false (or 0) then its an ActiveProduct.  You can see these mapped in the Entity Mapping Details below:

Figure 3

Figure 3: ActiveProduct Mapping

Figure 4

Figure 4: DiscontinuedProduct Mapping

Once we have the model defined, we can use Object Services to query our data based on type (I could have used LINQ but I think the Entity SQL is clearer in this case):

-- Returns all Products
SELECT VALUE p 
  FROM NWEntities.Products as p

-- Returns only DiscontinuedProducts
SELECT VALUE p 
  FROM NWEntities.Products as p 
 WHERE p IS OF(NWModel.DiscontinuedProduct)

-- Returns only ActiveProducts
SELECT VALUE p 
  FROM NWEntities.Products as p 
 WHERE p IS OF(NWModel.ActiveProduct)

Feel free to download the demo (it only works if you have Orcas Beta 2 and the Entity Framework bits installed) and let me know what you think.

Genghis v0.8 Released

I've been helping Chris Sells and the Genghis Group for a couple of years. I am proud to announce the newest build of Genghis (version 0.8) that includes all the features of version 0.5 ported to .NET 2.0.  Between versions 0.5 and 0.6 a conversion to .NET 2.0 was performed but a number of classes were dropped for one reason or another.  We've addressed these missing classes in this latest release.

If you are working with Windows Forms 2.0, check it out.  Its a great addition to the library.

Cookies Ruined the Breadcrumbs...

Trish and I are moving soon.  She's been sending me links to rugs for our new living room floor. She found an interesting one today:

target web problem

(click for larger view)

Why should you care?  Ignore the rug, notice the breadcrumb to the rug:

Target thinks that this Rug is in its XBox 360 Console section?  Or does it? When I looked at the rug on Trish's computer, it was in the right place (under household items).  So what happened?

Seems that a few days ago I was browsing Target to find an XBox 360 Elite to replace my dead console. Putting two and two together, I think that cookie's ruined the breadcrumbs. I think that target stores data as I browse their in a cookie to re-create where on the site I am. When Trish sent me a link, Target incorrectly assumed I was still using the same browsing from earlier (several days earlier) and ruined their cookies. 

I saw this very problem several years ago when I was working in Boston on an Internet site. It taught us to think carefully about what data to store where.  It forces you to think about user data carefully. In this case the breadcrumb data is stored as a cookie on my machine but I am still an anonymous user.  In this case I don't see why they wouldn't just re-create the breadcrumb by either storing data server-side or more interestingly from their database data.  Sure depending on their schema, perhaps this rug exists in a number of places in their catalog, but that would certainly been better than this. 

The fact is that when you design a website, remember that people are going to save and send URL's and side affects are going to happen.  Think about how users use your site, test edge cases and plan for them. So imagine if it was more embarassing:

Ok, stop imagining now...

My Entity Data Model Article is Up!

On TheServerSide.NET, my new article introducing the concepts of the Entity Data Model (i.e. Entity Framework, ADO.NET v.Next, etc.).  Let me know what you think!

 

OMG! Too Many Ways to do Data Access with .NET?

Its been a busy weekend for Microsoft.  First the announcement that EDM is being delayed six months to be after Orcas...now two new dynamic data access layers for web-based apps:

  • Astoria: Expose your data as web services for AJAX
  • Jasper: Another RAD solution to Data Access

I haven't looked at either of these *yet*, but I thought it was already confusing...now look a the data access toolbox from MS:

DataSets...LINQ for SQL (Server)...EDM...Astoria...Jasper

I can't imagine that the Data team is going to be able to give good enough advice as to where to use what.  Hopefully after I dig in deeper, it'll make more sense.

The C# Team seems to speak out of both sides of its mouth

I was reading an article about VB9's XML Literal support and why C# decided not to support it.  (Note, I agree with C#'s lack of support for it, but that's not what this post is about).  Paul Vick said:

It is extremely risky to tie yourself explicitly to a technology that may or may not be here 15 years from now. Right now, XML is king. But what happens if some other technology comes along and knocks it off its perch? What if things radically shift in some other direction and XML suddenly becomes a side track instead of the main line?

While I agree with this notion, this seems to be the exact reason for *not* including LINQ. Why are they willing to tie the language to a brand-new notion of language integration that might not be here in two years, but they saying they don't want to pollute the language with XML becuase they are not sure it will be here soon? 

It seems like they are talking out of both sides of their mouth on this one. If it is important that the language remain clear and simple, why introduce LINQ with the related features (extension methods and variable inference)?

New Website Look

I've reworked my web site. It was looking a bit more like the uniform of a NASCAR driver than a web site, so I reworked the layout to make it cleaner. I admittedly stole many of my ideas from other web sites and templates I saw.

The other reason for the change was to eliminate ViewState.  I noticed my pages ballooning from the sheer size of the HTML that was being generated, much of it as ViewState.  I've eliminated ViewState in almost every case.  For example, the size of the HTML of my home page was reduced from 134K to 48K.  That's just HTML size, not images...so the real size change should be even more dramatic.

Let me know what you think and if you find anything not working.  Thanks!

Orcas March CTP Released

I've gotten the new Visual Studio Orcas March CTP up and running (as the VPC it ships as).  I've been playing with the Entity Framework some today and I am pretty impressed so far. Unfortunately the automatic generation of the schema/mapping files still isn't working in this build, but if you write it out by hand it does work.  I'll be posting an example soon.