Ken Brubaker

The ClavèCoder

<September 2008>
SuMoTuWeThFrSa
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011


Navigation

Subscriptions

News

Kenneth Brubaker
Senior Application Architect

Locations of visitors to this page

Post Categories



Architecture (RSS)

Architecture
June 2008 Atlanta Cutting Edge .NET UG meeting: Entity Framework and Data Services

I was finally able to attend the June Atlanta Cutting Edge .NET UG meeting yesterday. Shawn Wildermuth gave a great presentation the on VS2008 SP1 data technologies: ADO.NET Entity Framework and ADO.NET Data Services (Astoria).

 

Shawn's recommendations were:

  • The Entity Framework (EF) is for enterprises with a large, stable data store
  • The most important part of EF is the Entity Data Model (EDM) itself. It is very robust in the mappings it can handle and the extensibility points available.
  • Enterprises should hold off and see whether Microsoft and third parties will invest in the EDM. He recommends nHibernate for now.
  • ADO.NET Data Services (DS) are only useful for Internet (not intranet or, presumably extranet) where data security is not an issue. His biggest concern was the serialization overhead. I basically interpret that to mean that you should not use DS for essentially 2 tier development.

Interesting points were:

  • Shawn was unsure whether EF exposes the model to consumers. I will have to investigate. He did believe, however, that the model is extensible.
  • They don't have model/db generation from objects, but they DO have round tripping between the model and the data store.
  • As discussed in the July 2007 MSDN article on EF, the Designer is lightweight and you should prepare yourself to be designing in angle brackets for the 1.0 release at least.
  • In 1.0, at least, EF will not support Unit of Work and POCO objects. It will support, however, what they call IPOCO, which means the standard data binding interfaces of INotifyPropertyChanged and INotifyCollectionChanged.
  • EF can only model/update a single database in 1.0
  • DS is a simple proxy layer (my words) over any LINQ source (IQueryable).
  • DS provides a command line code code generation step that provides a client side LINQ interface for .NET and Silverlight and a LINQ-like interface for ECMAScript. Nice. Anyone have a MSBuild task for it yet?

posted Tuesday, June 03, 2008 9:56 AM by kenbrubaker with 40 Comments

Yes you CAN build .Net 3.5 apps from VS 2005

According to Charles Young you simply need to install .Net 3.5 and change any relevant assembly references to .Net 3.5 versions. Of course, you can use the new language features such as the LINQ query syntax. But you could use the extension methods as regular static methods, for example.

 

However, in Scott Gutherie’s blog entry on the release of VS2008/.NET 3.5 this comment specifies a problem with upgrading the Ajax code. (Or maybe he did not upgrade the Ajax code.) From Scott’s reply they are not expecting any issues with the upgrade. There are tons of comments to this blog entry I may be work your wile to peruse the list to see if there are any other potential gotchas.

Daniel Moth affirms that the “Red Bits” of 3.5 are just the SP1 for .NET 2.0 and .NET 3.0.

A word of warning from Rick Straw: From an administrative standpoint the CLR is still at v2.0.

posted Thursday, April 17, 2008 10:53 AM by kenbrubaker with 0 Comments

MS Volta: Boundaries Are Implicit

It looks like Eric Meijer has taken retiring the the four tenets to heart. In his CTP announcement blog entry, Meijer states that Microsoft's project code-named Volta, service boundaries are crossed by decorating a class with [RunAtOrigin] and configuring for the origin on the application tier (disclaimer: I haven't yet looked at the implementation details of Volta).

This does not bode well for the contract-first folks and doesn't seemed to be aimed at long-lived commercial software. That focus would fit in well with Linq to SQL's target audience though.

I guess life is a mashup.

posted Friday, December 07, 2007 9:52 AM by kenbrubaker with 0 Comments

InRule delivers InRule for Workflow Foundation

In a large business services enterprise there may be several lines of businesses that have swiftly changing business rules. Windows Workflow Foundation (WF) was designed to provide a way to implement business processes and rules without coding.

Before WF came out, I saw several lines of businesses at Aon using InRule for this purpose. Now, InRule has released InRule for Windows Workflow Foundation.

Here are the bullet points from their marketing page:

  • An authoring environment that enables both developers and non-technical users to easily author, test, and maintain business rules the WF rules engine.
  • Capabilities to extend the Windows Workflow Foundation rules engine, including decision tables and 90+ built in functions.
  • A Rule Catalog to manage rule check-in/check-out, versioning, and permissions across systems.

I would encourage any enterprise with a strong Windows stack in some of their business unites to consider InRule as a rules engine standard.

They support WF alone and BizTalk Server, so it can scale with the size of a project. It has it's own version control system and deployment model. I can only hope it's better then Crystal XI. Regardless there will be work in that area to integrate rules deployment with your software releases.

posted Thursday, December 06, 2007 8:32 AM by kenbrubaker with 0 Comments

Writing custom providers without the overhead of Enterprise Library

Whatever you say about the the configuration functionality of Enterprise Library, one thing that won't be said is that it is straight forward. In fact, they created the Application Block Software Factory to help you through the five classes necessary to create the runtime configuration classes and a whole other set of classes for the design time experience.

Developers of small or local frameworks may not be willing to tie themselves to that horse just to set a few values in their web.config file.

Of course .Net 2.0 introduced the Provider Model, embodied in the System.Configuration.Provider.ProviderBase class. Unfortunately it's rather low on the workability scale itself.

This blog entry, by Phil Haack, shares a small generic library that will lower the bar to entry for making custom providers.

posted Tuesday, November 06, 2007 12:30 PM by kenbrubaker with 0 Comments

WCF Performance: Yes, you should have listened to Microsoft

Back in 2004 Microsoft encouraged distributed developers to base their work on ASP.NET Web Services (ASMX) architecture rather than .NET Remoting. From that moment I knew that .NET Remoting was moribund and should not be pursued for new development.

Some folks however preferred Remoting because it did not have the IIS overhead that ASMX did. I would say that unless not having IIS was a requirement, they were mistaken.

Clemens Vasters summarizes a Microsoft whitepaper that compares performance between the different MS technologies. The results? WCF is

  • %25 - %50 faster than ASMX
  • %25 faster than .NET Remoting
  • %100 faster - %25 slower than .NET Enterprise Services (DCOM)

Those are impressive numbers. Unfortunately for the Remoting folks, there is an easy upgrade from ASMX but no upgrade from .NET Remoting.

 

Go WCF my friend!

posted Monday, October 22, 2007 12:46 PM by kenbrubaker with 1 Comments

Two important LINQ implementations: LINQ to XSD and LINQ to SharePoint

There are two very important LINQ implementations to keep your eye on as we near the release of Visual Studio 2008, LINQ to XSD and LINQ to SharePoint.

 

LINQ to XSD

LINQ to XSD is a Microsoft effort that allows you to perform LINQ queries against strongly typed XML documents. This is a much better experience than you will get with LINQ to XML. See the links provided by Roger Jennings in his post on LINQ to XSD for examples of the difference. Using LINQ to XSD will give a much better developer experience that vanilla LINQ to XML. LINQ to XSD was released as Alpha in the Orcas Beta 1 release.

 

LINQ to SharePoint

LINQ to SharePoint is a Codeplex effort now in Alpha. Because it converts LINQ queries to SharePoint CAML queries, this is a great application of LINQ. I would definitely keep my eye on this implementation, since SharePoint is growing in importance and capability in the industry. More details in this Roger Jennings post.

posted Friday, July 13, 2007 4:00 PM by kenbrubaker with 0 Comments

JavaFX: Sun's weak go at RIA

RIA is currently populated by AJAX and Flash/Flex. Silverlight is an interesting newcomer because it provides one designer/developer experience for the all the UI offerings: Desktop, RIA, Mobile. And you can use your language of choice in a rich Design/Development experience.

 

Sun is attempting to get in to the RIA space with, in my opinion, a weak offering. JavaFX. Mary Jo Foly, of Microsoft Watch, I think has the most succinct analysis:

Sun's JavaFX fannouncement elt more to me like Sun's to reset Java and get the platform back on track than to break new ground.

posted Thursday, May 10, 2007 11:45 AM by kenbrubaker with 0 Comments

Real World Problems with Ruby on Rails

This Q&A with a member the TWITTER team shows that Ruby on Rails (RoR) is not, at this point, a scalable technology. The language itself is show (can be solved) and the reflection based idioms are also slow (could be solved with machine code generation, I suppose) and it's ability to scale out has limitations.

 

Microsoft is building a CLR-based Ruby implementation, IronRuby, which should be a lot quicker than current implementations. But this damning comment from the Q&A makes one wonder whether an enterprise should bet on this technology:

 

Once you hit a certain threshold of
traffic, either you need to strip out all the costly neat stuff that
Rails does for you (RJS, ActiveRecord, ActiveSupport, etc.) or move
the slow parts of your application out of Rails, or both.

posted Monday, May 07, 2007 11:36 AM by kenbrubaker with 0 Comments

SQL Compact: Yet another SQL Server edition

Microsoft has just released SQL Compact, an upgrade of SQL Mobile that supports the desktop. Here's a white paper describing when to use Compact over Expression edition. Upshot? Application embedded database in SQL Compact. Lightweight, but full featured DB in Express Ed.

Not mentioned but I'd have to think that SQL Compact has a much nicer deployment story.

posted Wednesday, January 24, 2007 10:50 AM by kenbrubaker with 0 Comments

Tim Ewald's solution for XML Schema versioning

Tim Ewald shares his solution for XML Schema versioning problems. Instead of using xs:any, which causes lots of problems, have the schema validator simply ignore nodes it doesn't recognise and validate those it does recognise. Tim says schema validators will allow you to ignore validation errors, and says he will have an example soon. The contract is:

  • A service can evolve it's contract in a controlled way without breaking clients
  • Clients must assume that the contract they get is a snapshot in time and the service is free to evolve it's contract in a controlled way
  • An application producing an XML instance should make sure it matches the schema that application is using
  • An application consuming an XML instance should assume it matches the schema that application is using plus additional elements
  • If an application consuming an XML instance wants to schema validate it, it should be forgiving in how it deals with unknown elements in the stream and should not simply throw exceptions

He has his code and several more entries:

 

posted Tuesday, November 28, 2006 11:26 AM by kenbrubaker with 0 Comments

How to use IToken for ISecurityCacheProvider with Forms Authentication

How can you use the IToken you get from ISecurityCacheProvider and store it in the FormsAuthenticationTicket? From ISecurityCacheProvider.SaveXyz(xyz) you can't. You can use IToken.Value to get a serializable representation. But there is no way to reconstitute it from the string value. Some Memento pattern!

I discovered the solution when I saw GuidToken and realized that the overload ISecurityCacheProvider.SaveXyz(xyz, token) would do the trick. I though, wrongly, that the token was a real memento that the security cache provider supplied. No, the Consumer should supply the token. As long as it supports IToken.Value it can take any form the consumer needs.

My suspicion was confirmed by this post by Adam Getchell detailing how to do it using EntLib 1.x. Though I don't like the BasePage approach, I'll take the snippet in BasePage.OnInit that shows how to get the token from the ticket and get the principal from the cache. Just what I expected.

posted Monday, March 20, 2006 9:35 PM by kenbrubaker with 0 Comments

Where virtualization is heading

For someone wanting to find out where we are headed in the Enterprise using virtualization, I highly recommend the Channel 9 "Going Deep" episode on Virtualization(video).

The episode host, not the techs, was making it clear that this will be core OS architecture in the future. The techs, however, confirmed this by saying that that was the reason that they are position as a Kernel group. Concepts discussed included:

  • Legacy OS support
  • Server Consolidation
  • App Isolation
  • Implications for Disaster Recovery
  • Hypervisor technology
  • Enlightened Guest OSs
  • Dynamic, autonomous VM management, a kind of self managing VMotion.

 However, the techs' vision went way beyond these to the point where different subsystems core can live on their own VM. The example given was an IP Phone stack that could keep running even if the host OS blue-screened. That's isolation with n the OS itself.

One big thing from a practice perspective, one tech mentioned a built in "undo" that virtual server has to move a VM back to a starting configuration. I need to investigate that further for integration machines.

posted Sunday, February 19, 2006 11:15 PM by kenbrubaker with 0 Comments

The final word: Guid (uniqueidentifier) primary keys in database tables

Update: Added Link fro Sql Server Magazine.

Since 2001 I have advocated Guids as surrogate primary keys in database tables over identity fields. The reasons are two fold.  First, I can design for "one way traffic" in that I don't need to query the identity field and wire it back in saving a lot of goo code. Second, I can wire up an object graph with persistent ids and save them in one go, saving significant round trip costs. A third side benefit is that any data error in the object graph can be tagged with the Guid so that any client can navigate to the offending object. All in all, an ORM-geek's dream.

The catch is clustered key index fragmentation. I'll point you shortly to blog post by Kimberly Tripp that explains the issue. Suffice it to say that Guid primary keys it has been a hard sell to DBAs (Having a surrogate key itself can be a hard sell). However, I believe that "Code for Clarity. Optimize Empirically" applies to databases as well. A clear data model makes everyone's life easier. So what to do?

Well, SQL Server 2005 now supports the newsequentialid function. Defined only for the default clause, it creates a unique monotonically increasing uniqeidentifer field. Kimberly Tripp gives a thumbs-up along with some great analysis. A must read.

Now the issue, of course, is that I want to create Guids in the Id properties of the objects. I can think of two steps to enable compatibility. The first step is a configurablity switch so that some model objects do not create their Guids. You would need to inactivate the objects after they are persisted or implement round-tripping the keys, which is untenable for object graph persistence. However if you need the performance you already are special-casing your code, so some extra thought for these objects should not be a real issue.

Paul Wilson asked:

I've always been under the impression that the main reason to choose guids over int (or bigint) identities was for either replication and/or so clients could generate their own unique keys. But it doesn't seem like this new sequential "guid" can be of any value in either of these situations -- so why not just use an identity?

For me the issue is object graphs. To save an object graph performantly you need to put all the inserts/updates/deletes in one batch. When you do so, you need some prewiring of the objects, since, on insert their persistant ids (if you are not using identities) would not exist yet. Even if you did some sort of use of @@identity in the batch you still have the problem of handling errors in the batch. If you have an error persisting change in an object in an object graph (or a collection of objects, for that matter) how do you communicate which object erred? You need a prewired id. Having a Guid solves all these problems.

Moreover, this benefit reaches the whole way up and down the call stack. If you have a JScript Ajax client call a web service call an other web service call the database, you need to propagate the ids and/or errors the whole way up the call chain. This either produces a lot of cumbersome coding or painful architectonic. The Guid, however is painless: anyone can generate a Guid, so objects can be created anywhere along the chain and anyone who needs a persistent handle to the object  a priori gets one for free.

Thus the question remains: how do you integrate a frame work that depends on early generation of Guids with newsequentailid, which requires late generation of Guids. That was what I was addressing in this post.

Oh, a final benefit is it's easy to encrypt a Guid; some ints are rather small for encrypting, in my opinion. An encrypted Guid makes a nice opaque id in a URL. Remember, don't forget the salt!

More on newsequentialid from SQL Server Magazine (subscription required)

posted Thursday, February 09, 2006 7:31 AM by kenbrubaker with 3 Comments

How should a corporation support WCF duplex messaging?

Sean Cicoria has a reasonably well written intro on the Duplex Messaging feature in WCF. He lays out the key configuration requirement to enable duplex messaging: one and only one port must be configured through the client firewall for all WCF applications that want to use it.

I believe the clear guidance, then, is:

  • Use client/server duplex messaging in
    • corporate situations (not internet)
    • where you "own the desktop"
    • the desktop will be XP SP2 or better
    • you need duplex messaging (notifications, long running job interface, etc.).
  • If you "own the desktop," part of your migration to WinFX is to determine the WCF receive port and enable it on all the clients (with appropriate security settings, of course).
  • Roll out WinFX to servers with duplex messaging port enabled.
  • Use server/server duplex messaging freely.

posted Saturday, February 04, 2006 6:43 AM by kenbrubaker with 0 Comments

Why SQL Server Express is the obvious choice

On a recent project, a reviewer mentioned that SQL Server Express should never be used in a corporate application because companies would never install a database on the client. This is wrong headed because of two important trends: IT Centralization and ClickOnce Deployment.

As part of an organization that had many hundreds of Access applications to migrate to a new Wide Area File System (WAFS) infrastructure I can inform you on the pain of herding a plethora of unmanaged databases. As the tools to centrally manage IT improve, it will become more and more untenable for a corporation to accept unmanageable databases.

I say unmanageable databases, because the second trend, ClickOnce Deployment, not only speaks of centralized deployment but also of unprivileged user installations; really, self-service installations. This is the "trick" of Express Edition that older school architects are missing, in  my opinion. You get the deployment and database management ease of an MDB file but the power of a real database. With Expression Edition being virtually part of the operating system (something you can enforce with centralized IT), internal teams can play with MDF files just as easy as they did with MDBs, but, when it is time to grow up, the switch to a centralized server is painless.

A final trend is simply inevitability: JET and MDAC are dead; Long Live SQL Server Express Edition. Deal with it.

posted Monday, January 23, 2006 8:15 AM by kenbrubaker with 0 Comments

When to use Schematron

Dare's article on Schematron a ways back showed how to use Schematron for validation and mix it with Xml Schema. The architectural question is: when should you use it?

As a corporate architect I heard many projects where agreement on the XSD contract was the easy part. It is the rest of the taxonomic rules that took the most work between partner companies. This is where Schematron comes in.

You do not need Shematron if you:

  • own both sides of the contract and they are deployed together. In that case you should have a helper or adapter class that owns the taxonomic business rules.

You should use Schematron if you are:

  • making a standard spec used by third parties
  • working with a partner company that owns the "other side" of the contract

You can use Shematron

  • all the time as a documentation tool for otherwise implied semantic rules

Any other reasons you can think of?

posted Friday, July 22, 2005 12:20 PM by kenbrubaker with 0 Comments

Atlas details

Don Box shares links from two ASP.NET leads on the new Atlas Ajax technology. Read them or miss out!

posted Wednesday, June 29, 2005 3:40 AM by kenbrubaker with 0 Comments

Wanna do Ajax? Microsoft to guide the way with Atlas.

Update: sorry, forgot link to the article.

This C|Net news article introduces Atlas, a client side object model for JavaScript (read DHTML) coding. My readers may know that I believe that the end of Ajax, WSRP, and Portlets leads directly to Smart Clients. It's interesting that the article itself calls JavaScript spaghetti-code. Why write spaghetti code when you could be doing Avalon+Indigo? None, unless you want to support the minority (is this true?) of systems that won't run them.

posted Tuesday, June 28, 2005 4:17 AM by kenbrubaker with 1 Comments

Intro to Ajax in ASP.NET 2.0
Here's a great post by MVP Rick Strahl on how to client-side callbacks (Ajax) using the built in features of ASP.NET 2.0. Looks like more plumbing and glue are needed for it to succeed in a large project.

posted Friday, June 24, 2005 4:39 AM by kenbrubaker with 0 Comments