Friday, May 13, 2011

LINQ to SQL vs Entity Framework vs NHibernate

I am working on a new presentation that is essentially a compare and contrast analysis of the three major ORMs out there (LINQ to SQL, Entity Framework, and NHibernate). My problem is not the content, it's choosing a name for the presentation! Here are just a few ideas that I've been considering:

  • Ultimate Fighter
    • Ultimate Fighter: ORM Edition!
    • ORM Showdown: The good, the bad, and the query.
    • ORM Fight Night
    • Object Relational Matchup
  • Misc Movies
    • ORM Club: If it's your first night, your app has to fight.
    • Super-ORM-Man 4: The Quest for Business Logic
    • Dr. Strange DAL: Or how I learned to stop worrying and generated an ORM!
  • Video Games
    • World of ORM Craft
    • pORMtal: This is a triumph!
    • pORMtal 2: Wa are going to have fun, with computer science!
  • Star Wars
    • ORM Wars, Episode 4: A New DAL
    • ORM Wars, Episode 5: The Profiler Strikes Back
    • ORM Wars, Episode 6: Return of the DAL
  • Indiana Jones
    • ORM and the Raiders of the lost DAL
    • ORM and the DAL of Doom
    • ORM and the Last Cascade
  • Star Trek
    • ORM Trek 1: The Data Access Layer
    • ORM Trek 2: The Wrath of DAL
    • ORM Trek 3: The Search for Business Logic
    • ORM Trek 4: The Request's Roundtrip Voyage Home
    • ORM Trek 5: The Data Access Frontier 
    • ORM Trek 6: The Undiscovered Productivity
    • ORM Trek 7: Code Generations
    • ORM Trek 8: First Contract
    • ORM Trek 9: SQL Injection
    • ORM Trek 10: ADO.Nemesis
  • The Hobbit
    • Lord of the ORM: Fellowship of the Data Layers
    • Lord of the ORMs: The Batch Queries
    • Lord of the ORMs: Return of the DAL
    • There and Back Again: An Entity's Tale, by ORM

Wednesday, May 4, 2011

PLINQO for NHibernate, Beta 1 Released!

PLINQO makes NHibernate "so easy, even a caveman can do it."

PLINQO can generated your HBM files, entity classes, and all NHibernate configuration in seconds. It then allows you to safely regenerate that code at anytime, thus synchronizing your mappings with the database while still intelligently preserving custom changes. PLINQO for NHibernate is a enhance and simplify wrapping of NHibernate that brings the best practices, optimizations, and convenience of the PLINQO frameworks to NHibernate.

Check it out, ya'll! Check it check it out!

Friday, April 29, 2011

CodeSmith 2011 User Group Tour Update!

The Arkansas leg of the tour went really well. Hey, rest of the US: Arkansas has an amazing .NET community! I don't know what's better, their top notch developers or their gorgeous scenic byways? Either way, I am officially a huge fan of Arkansas. My thanks to everyone who came who out, and a special thanks to all the user group leaders.

Update: We have added a Louisiana leg to the tour!

Calling all Louisiana .NET developers, I will be visiting your city the second week of August! If you live in Shreveport, New Orleans, Baton Rouge, or Lafayette, be sure to come out to your local DNUG and learn about (among other things) code generation!

Dates

  • New Mexico
    • May 5th (Thursday) - New Mexico - Attack of the Cloud
  • Iowa
    • May 9th (Monday) - Cedar Rapids - Code Generation
  • Texas
    • May 11th (Wednesday) - DFW Connected Systems UG - PLINQO: Advanced LINQ to SQL
  • Florida
    • May 26th (Thursday) - Memphis - Code Generation
    • June 1st (Wednesday) - Brevard County  - PLINQO: Advanced LINQ to SQL
    • June 2nd (Thursday) - Tallahassee - Attack of the Cloud
    • June 7th (Tuesday) - Deerfield Beach - Code Generation
    • June 8th (Wednesday) - Fort Walton Beach - Code Generation
  • Alabama
    • June 9th (Thursday) - Mobile - Code Generation
  • New York
    • July 6th (Wednesday) - Fairfield - Code Generation
    • July 7th (Thursday) - Long Island - Code Generation
  • Louisiana
    • August 8th (Monday) - Shreveport - Attack of the Cloud
    • August 9th (Tuesday) - New Orleans - Code Generation
    • August 10th (Wednesday) - Baton Rouge - Code Generation
    • August 11th (Thursday) - Lafayette - Code Generation

Topics

  • Attack, of the Cloud!
    • Cloud computing is great, but what do we put in the cloud? The web is advancing at an incredible pace and it’s time to start building true Web Applications, not just web sites! Web Apps shake off the constraints of operating system specific frameworks and free developers to work in an open standards based environment. This session will cover a variety of topics ranging from ASP.NET MVC development, unit testing, REST APIs, JSON, JQuery, ExtJS, tips and tricks, lessons learned, and more. It will conclude with building a sample blog reader Web App, and then deploying that to Windows Azure.
  • Generate Your Code!
    • Code generation is a powerful practice that allows you produce higher-quality, more consistent code in less time. This helps remove the mundane and repetitive parts of programming, allowing developers to focus their efforts on more important tasks, and saving companies time and money. Code generation enables you to: efficiently reduce repetitive coding, generate code in less time with fewer bugs, and produce consistent code that adheres to your standards.
  • Using Embedded QA to Build Rock-Solid Software
    • Without an automated means to collect errors from deployed applications, how can you know that your software is performing as expected? Embedded QA can be used to augment your own internal QA efforts, greatly increasing both the effectiveness of your testing and overall stability of your applications. As Jeff Atwood phrased it, "If you're waiting around for users to tell you about problems with your website or application, you're only seeing a tiny fraction of all the problems that are actually occurring. The proverbial tip of the iceberg."
  • PLINQO: Advanced LINQ to SQL
    • In the time that LINQ to SQL has been available, we have been identifying ways to make LINQ to SQL better. We have compiled all of those cool tips and tricks including new features into a set of CodeSmith templates. PLINQO opens the LINQ TO SQL black box giving you the ability to control your source code while adding many new features and enhancements. It's still LINQ to SQL, but better!

Hope to see you soon!
~ Tom

Tuesday, April 12, 2011

Two Important Questions about PLINQO EF

The .NET community is the best development community ever.
How do I know that? Because they ask the best questions!

Here are two really important questions that we have been asked concerning PLINQO for Entity Framework that I wanted to call some extra attention to:

What is the advantage of using PLINQO EF instead of standard Entity Framework?

In 1.0 the primary goal was to improve the regeneration story of Entity Framework, thus making it easy to update and sync data and code changes. The entities are pretty much equivalent, but the PLINQO query extensions greatly improve and simplify the composition of queries.

With future versions there will be more features brought in from the PLINQO for L2S feature set.  This will include built in caching, auditing, enhanced serialization, possibly WCF and DataServices support, and hopefully batch/future queries!

What are the benefits, if any, of moving to PLINQO EF over PLINQO L2S?

Such benefits are not there yet, but will be. The primary reason to migrate right now would be to inherit the benefits that standard EF has over L2S, most notably is its multiple database support (so more than just SQL Server).

There will be a simple migration path between the two versions of PLINQO, but the bottom line is that PLINQO EF is not ready for that yet. It is still in beta, and is simply not yet as feature complete as PLINQO L2S. It's going to take one or two releases until we get there, but we will get there! :)

Tuesday, March 29, 2011

Presentation Downloads

Presentation downloads are (finally) up!

The PLINQO presentation will be up some time next week.

Enjoy!
Tom

Friday, March 18, 2011

OAuth 2.0 for MVC, Two Legged Implementation

OAuth 1.0 was one complicated beast. The OAuth 2.0 spec greatly simplified things, but that also had the wonderful side effect of rending all of our old OAuth 1.0 code obsolete. They say that "the only thing a pioneer gets is an arrow in the back," I disagree, I say "the thing that only a pioneer gets to have is an adventure."

For example, I got to help write this wonderful, cutting edge, open source, OAuth 2.0 implementation for MVC!

OAuth 2.0 Overview

OAuth is all about tokens. You start by getting a Request Token from the server, and then using that to secure your login information. When you have successfully logged in you will be given a role/permission specific Access Token, you will then submit this token with all of your future requests. You will also get a Refresh Token with your Access Token. Once your Access Token has expired, you can then submit your Refresh Token to get a new pair of Access and Request Tokens.

Two Legged vs Three Legged

A two legged implementation is rather straight forward, you log into the server you are trying to access. A three legged implementation allows you to gain access to a resource by authentication with a third party server.  For the time being this project only supports two legged authentication.

Implementation

You must implement four classes to use this library:

  1. OAuthIdentityBase
  2. OAuthPrincipalBase
  3. OAuthProviderBase
  4. OAuthServiceBase

The first three are very small classes, requiring only a few short lines of code. The Service is the work horse where most of your code will go, but even then it only requires the implementation of four methods.

public abstract class OAuthServiceBase : ProviderBase, IOAuthService
{
    public static IOAuthService Instance { get; set; }
    public abstract OAuthResponse RequestToken();
    public abstract OAuthResponse AccessToken(string requestToken,
        string grantType, string userName, string password, bool persistent);
    public abstract OAuthResponse RefreshToken(string refreshToken);
    public abstract bool UnauthorizeToken(string token);
}

Then of course you will need to update your Web.config:

<configuration>
  <configSections>
    <section name="oauth" type="OAuth2.Mvc.Configuration.OAuthSection, OAuth2.Mvc, Version=1.0.0.0, Culture=neutral"/>
  </configSections>
  <oauth defaultProvider="DemoProvider" defaultService="DemoService">
    <providers>
      <add name="DemoProvider" type="OAuth2.Demo.OAuth.DemoProvider, OAuth2.Demo" />
    </providers>
    <services>
      <add name="DemoService" type="OAuth2.Demo.OAuth.DemoService, OAuth2.Demo" />
    </services>
  </oauth>
  <system.web>
    <httpModules>
      <add name="OAuthAuthentication" type="OAuth2.Mvc.Module.OAuthAuthenticationModule, OAuth2.Mvc, Version=1.0.0.0, Culture=neutral"/>
    </httpModules>
  </system.web>
</configuration>

Securing Your Pages

That's the easy part, just add the MVC Authorize Attribute to any actions or controllers that you want to secure.

public class HomeController : Controller
{
    public ActionResult Index()
    {
        return View();
    }
 
    [Authorize]
    public ActionResult Secure()
    {
        return View();
    }
}

The Demo API in Action

  • /oauth/requesttoken
    • Request Params
      • None
    • Result
      • RequestToken = a028f1895cc548af9de744f63d283f6e
      • Expires = 300
      • Success = true
  • /oauth/accesstoken
    • Request Params
      • oauth_token = a028f1895cc548af9de744f63d283f6e
      • username = tom
      • password = c4e5995d4cb8b26970336b956054ac1be9cc50b3
    • Result
      • AccessToken = 3b23ee5f128a45c88e657ecc74c41bbc
      • Expires = 300
      • RefreshToken = 85126a53bca940f1ae7c9d797f63a274
      • Success = true
  • /oauth/refreshtoken
    • Request Params
      • refreshToken = 85126a53bca940f1ae7c9d797f63a274
    • Result
      • AccessToken = 8cfc317af6ed45b2b065a8fa5da3ba81
      • Expires = 300
      • RefreshToken = d0b4a8898d974e939ca83b55cfeabcac
      • Success = true
  • /oauth/unauthorize
    • Request Params
      • oauth_token = 8cfc317af6ed45b2b065a8fa5da3ba81
    • Result
      • Success = true

Additional Resources

Happy authenticating!
~ Tom

Friday, March 11, 2011

CodeSmith 2011 User Group Tour

The CodeSmith Tools are hitting the road (and even the skies) to talk about .NET technology all around the US!
Want us to speak at your local user group? Just drop me a line!

We will post again each month with updates and additional details, so stay tuned!

Dates

  • Oklahoma
    • April 4th (Monday) - Oklahoma City DNUG - PLINQO: Advanced LINQ to SQL
  • Arkansas
    • March 25th (Friday) - North West Arkansas TechFest 2011 - Attack of the Cloud
    • April 11th (Monday) - Fort Smith DNUG - PLINQO: Advanced LINQ to SQL
    • April 12th (Tuesday) - North West Arkansas DNUG - TBA
    • April 13th (Wednesday) - North West Arkansas SQL Server UG - PLINQO: Advanced LINQ to SQL
    • April 14th (Thursday) - Little Rock DNUG - Using Embedded QA to Build Rock-Solid Software
  • New Mexico
    • May 5th (Thursday) - New Mexico DNUG - Attack of the Cloud
  • Iowa
    • May 9th (Monday) - Cedar Rapids DNUG - Code Generation
    • August 4th (Thursday) - Des Moines DNUG - Using Embedded QA to Build Rock-Solid Software
  • Texas
    • May 11th (Wednesday) - DFW Connected Systems UG - PLINQO: Advanced LINQ to SQL
  • Florida
    • May 26th (Thursday) - Memphis DNUG - Code Generation
    • June 1st (Wednesday) - Space Coast DNUG - PLINQO: Advanced LINQ to SQL
    • June 2nd (Thursday) - Tallahassee DNUG - Attack of the Cloud
    • June 7th (Tuesday) - Deerfield Beach DNUG - Code Generation
  • New York
    • July 7th (Thursday) - Long Island DNUG - Code Generation
    • TBD - Fairfield DNUG - Code Generation

Topics

  • Attack of the Cloud
    • Cloud computing is great, but what do we put in the cloud? The web is advancing at an incredible pace and it’s time to start building true Web Applications, not just web sites! Web Apps shake off the constraints of operating system specific frameworks and free developers to work in an open standards based environment. This session will cover a variety of topics ranging from ASP.NET MVC development, unit testing, REST APIs, JSON, JQuery, ExtJS, tips and tricks, lessons learned, and more. It will conclude with building a sample blog reader Web App, and then deploying that to Windows Azure.
  • Code Generation
    • Code generation is a powerful practice that allows you produce higher-quality, more consistent code in less time. This helps remove the mundane and repetitive parts of programming, allowing developers to focus their efforts on more important tasks, and saving companies time and money. Code generation enables you to: efficiently reduce repetitive coding, generate code in less time with fewer bugs, and produce consistent code that adheres to your standards.
  • Using Embedded QA to Build Rock-Solid Software
    • Without an automated means to collect errors from deployed applications, how can you know that your software is performing as expected? Embedded QA can be used to augment your own internal QA efforts, greatly increasing both the effectiveness of your testing and overall stability of your applications. As Jeff Atwood phrased it, "If you're waiting around for users to tell you about problems with your website or application, you're only seeing a tiny fraction of all the problems that are actually occurring. The proverbial tip of the iceberg."
  • PLINQO: Advanced LINQ to SQL
    • In the time that LINQ to SQL has been available, we have been identifying ways to make LINQ to SQL better. We have compiled all of those cool tips and tricks including new features into a set of CodeSmith templates. PLINQO opens the LINQ TO SQL black box giving you the ability to control your source code while adding many new features and enhancements. It's still LINQ to SQL, but better!

Hope to see you soon!
~ Tom 

Real Time Web Analytics