Monday, February 28, 2011

Why not ORM: OpenAccess Watcher, Part 3

ORM-Robot-watcherIn part 1 of this ongoing series, we dispelled ORM myths, shaking the errant assumptions that many developers still hold about ORM. In part 2, we took a deeper look at why and how you can learn to trust the SQL an ORM produces. In part 3, we'll examine a simple tool I've crafted to help with that SQL visualization when using Telerik's OpenAccess ORM.

WHAT DOES THE TOOL DO?

The goal for this tool is simple: make it simple to visualize and summarize in real-time the SQL output from any OpenAccess-powered application. My self-imposed requirements were simple, too:

  • The tool must add value above and beyond what OpenAccess' built-in logging provides
  • The tool must be easy to setup with any application (win or web)
    • At most, 1 assembly reference, 1 line of "initialization" code
  • The tool must work with "new" (Visual Designer) and "classic" (IObjectScope) OpenAccess

THE RESULT: OPENACESS WATCHER

The tool, which I've dubbed OpenAccess Watcher, is composed of two parts:

  1. The Watcher- This is a simple WinForms application built with the Telerik RadControls for WinForms and the SharpDevelop TextEditor (for syntax highlighting) that "listens" for messages from OpenAccess applications.
  2. The Sender- This is a custom OpenAccess TraceListener that builds on the built-in OpenAccess logging to format and send messages in real-time to The Watcher, which in turn handles the visualization. There is also some advanced use of JustMock's CodeWeaver, but more on that in a moment.

The key thing to understand is that (for the most part) this tool is working with the same data you might find in the OpenAccess logs. It's value is in the summary stats it provides, the easier data navigation and visualization, and the "real-time" nature of the log output.

USING OPENACCESS WATCHER

Sticking to my requirements, OpenAccess Watcher requires minimal setup. To use it in an OpenAccess-powered app, you must simply:

  1. Add a reference to the assembly that contains "The Sender" (OpenAccessWatcher.Listeners.dll)
  2. Initialize the custom TraceListener during your application startup
    • For Web, this means 1 line of code in Application_Start in Global.asax
    • For Win, this means 1 line of code in your Program's Main method

That's it! Two steps. Now all you need to do is open "The Watcher" and start your application. If everything is working, you'll start seeing OpenAccess generated SQL show-up in The Watcher. (A complete "Getting Started" readme is available with the code.)

UNDERSTANDING THE LOG DATA

Since this tool does depend heavily on the OpenAccess log data, it's important to understand what's available. First, what's available is directly connected to the level of logging you've configured. The three common modes are:

  • Normal - This is good for capturing the basic SQL statements, but omits most of the log data that can be used to interpret other behaviors (like row count).
  • Verbose - This is good for capturing most SQL behavior, including connections, but it can significantly slow the execution of some applications.
  • All - This gives you maximum logging data and enables you to measure things like total rows returned and total data readers opened. Unfortunately, this can really slow down bigger apps.

My suggestion: Start with verbose. If that makes your app unbearably slow, try using normal. If your app runs tolerably with verbose and you want to try to get event more data, then give all a try.

It should also go without saying, these are not settings for production or for measuring application speed. These are settings specifically designed for visualizing SQL behavior during development, with the goal being to use the info for tuning ORM performance configuration.

EXAMPLE APP

To test OpenAccess Watcher, I've got a simple WinForms application with a RadGrid that loads data using the OpenAccessDataSource. When I open the page with this grid, I see the following in Watcher:

SNAGHTML41e98abc

There are three primary areas of information:

  1. SQL Activity Log (A) - This is a raw log of the SQL queries generated by OpenAccess (pulled from the OpenAccess logs). This data is displayed in a RadGrid for WinForms, so you have the complete ability to sort, filter, and group this data.
  2. SQL Visualizer (B) - Using the open source ShareDevelop TextBox, this area better visualizes the selected SQL statement so that you can easily review the SQL with syntax highlighting.
  3. Statistics Summary (C) - This area displays the values from various logging counters that summarize OpenAccess database activity. The version of OpenAccess you're using and your logging settings will impact that values that are available here.

While I'll save a full discussion of how to work with this data for Part 4, it's worth noting now that there is not a one-to-one relationship between SQL queries and database connections. OpenAccess typically prepares and executes multiple queries in batch, so don't freak out if you see larger numbers of queries.

ADVANCED LOGGING: CODE INJECTION

As I alluded to above, I am making use of Telerik's very cool CodeWeaver library, available with JustMock, to do IL injection with OpenAccess assemblies. This allows the custom TraceListener to go beyond tracking OpenAccess log data and inject code in to key OpenAccess methods that is used for gathering statistics.

Newer versions of OpenAccess (Q3 2010+) have convenient IntelliTrace and CommandWrapper classes through which all OpenAccess connections and transactions pass, so by injecting some counters in these methods I am able to report on connections and transactions even when logging is tuned-down or disabled.

For older versions OpenAccess, I am not able to do counters as easily, but there is still some injection in to the very low-level Transaction and Connection runtime implementations to help gather as many stats as possible for the visualizer.

In all cases, the code injection tooling will only work when the JustMock profiler is enabled. When not available, you'll get fewer stats.

IT WORKS ON MY MACHINE DISCLAIMER

This is an experimental project. It is not guaranteed to work with your setup. If it doesn't, I'm sorry. Send me feedback and I'll see what I can do to make it cover more scenarios. Known caveats with this preview:

  • I'm primarily focusing on SQL Server scenarios today. It should work for other OpenAccess providers, but I haven't tested that yet.
  • I've only tested this with .NET 4.0 projects. I'm not sure what will happen if you try to use the custom TraceListener with older .NET versions.
  • Your application probably needs to be running in full trust to support the reflection and code injection tooling that's going on.
  • The UI of the WinForms app can "hang" when huge volumes of logging data are being collected. Just wait a few seconds and it should become more responsive.

THE BITS

Disclaimer out of the way, here are the bits. Enjoy and share your feedback.

In Part 4, I'll show you how you can use The Watcher to start learning and optimizing the SQL generated by OpenAccess. Since OpenAccess has powerful configuration and optimization options, it's surprisingly easy (compared to other ORMs) to tweak once you have a clear understanding of what's happening.

Thursday, February 24, 2011

Why not ORM: Trusting SQL, Part 2

ORM-RobotIn part 1, we examined and busted 5 common ORM myths. Actually, we busted 4.5. We agreed that one myth, that you can't trust the SQL an ORM produces, is plausible. Let's bust that myth, at least bust it for OpenAccess ORM, today.

IN TOOLS I TRUST

One of the biggest barriers to adopting any time saving development tool is trust. You have to trust that the work the tool is doing to save you time is of equal or better quality than the same work you would otherwise do by hand. A development tool is in many ways like a co-worker or contractor. You have to get to know the results they produce before you can stop worrying about including their output in your project.

This is true for refactoring tools (like JustCode), UI components (like the RadControls), and especially true for data tools like OpenAccess ORM.

But how do you go about "trusting" a tool like OpenAccess ORM? Transparency.

OPEN THE BLACK BOX

With ORMs, many fears root in the perceived "black box" nature of what's happening under the covers. Many developers are familiar with hand crafting EACH-and-EVERY-sql-statement, and it can be unsettling to let some ORM robot start automagically creating your SQL based on abstracted LINQ. What if the SQL is inefficient? What if way too much SQL is being generated? What if the ORM "select *" my database?!

The result of this fear is often cut-and-run. Dump (or don't start using) the ORM and stick with time-wasting, but 100% transparent hand coding.

What developers need is an easy way to open the ORM black box and see what's really happening. Cut-out the "what ifs," and replace them with "when I do X, the ORM will do Y."

WHAT *IS* REALLY HAPPENING?

While ORMs like OpenAccess are unbelievably sophisticated, giving you the power to map database objects to code and even update schemas from code-based models, at the very root of the implementation is code you know. Standard (best practice) .NET for moving data between various databases. In the case of SQL Server, you'll find ADO.NET and SqlCommands, Transactions, and Connections.

The important thing to know is that this "standard" code is built by super-smart developers that are 100% focused on best practice data programming. Think about that. When you use a well built ORM, it's like adding a .NET data programming expert to your team, freeing you to really focus and be an expert on other layers of your app.

Then there's the SQL. And here it's worth noting, not all ORMs are created equal. The way an ORM converts LINQ or OQL or whatever in to SQL, and the ability on top of that to optimize the SQL through configuration, is often what makes one ORM better than another. With a quality ORM, though, you get SQL generated by programmers that are again 100% focused on SQL programming.

Now, much like you must "speak Google" to get the search results you expect, you usually need to learn how to "speak ORM" to get the SQL output you expect. That means you need to form an understanding of how the abstracted data languages (usually LINQ) produce SQL so you know when extra optimization configurations are needed. Do that, and there is no reason the SQL created by an ORM will be any different than the SQL you would create by hand (it may even be better!).

A good ORM is more than a tool. It's a .NET data programming and SQL expert. But how do you prove that to yourself? And how do you learn to speak ORM?

THE ORM LOOKING GLASS

You should never blindly trust any tool. Just as I'd expect you to inspect the HTML produced by the Telerik Extensions for ASP.NET MVC, I'd expect you to inspect the SQL produced by OpenAccess. Doing so not only helps you learn when and how to optimize ORM programming, but it helps you build the trust in your essential data tool.

Fortunately, OpenAccess provides a couple ways to open the "black box" out of the box:

  1. Logging
    If you've never used OpenAccess logging, you may be amazed at what can be easily logged with the simple change to a couple of config settings. All SQL statements, parameter values, database connections, and even returned rows can be captured by OpenAccess logging for your thorough review. Logs can be output to the console, a text file, or even directly to a in-memory StringWriter, and volume of data that is captured depends on your logging level. More on that in the next post.
  2. IntelliTrace
    For added runtime debugging transparency, OpenAccess (as of Q3 2010) provides deep insight with integrated IntelliTrace support in Visual Studio 2010. As you step and debug your app, IntelliTrace can reveal the SQL OpenAccess is producing and executing.

Both of these approaches are useful, but they do require you to manually "parse" the logs or trace stacks to understand what's happening when your program runs. Is there an easier way to see the bigger picture?

WATCHING OPENACCESS

Taking advantage of the OpenAccess logging output via a custom TraceListener (along with a few other tricks for newer versions of OpenAccess), I've created a simple tool designed to help you better visualize what OpenAccess is doing when your application runs.

openaccess-watcher

The advantages of this tool:

  • Easier to visualize, syntax-highlighted SQL
  • Convenient log sorting, filtering, and grouping (provided by RadGridView)
  • Summary values for key behaviors (total connections, total queries, total transactions, etc.)
  • Real-time visualization of OpenAccess output

In part 3, I'll provide a more complete overview of this new tool and provide a basic working version that you can try with your own OpenAccess-powered applications. The main idea behind this tool: make it dead simple to open the OpenAccess black box and visualize the "real" SQL.

Whether you use built-in logging output or a visualization tool like this, take the time to get to know your ORM. If you can build a trust with a powerful ORM, like OpenAccess, you'll leave hand-coding data access in the past where it belongs and never look back.

Can you trust the SQL produced by an ORM? Definitely! You just need to take a look. It's not in a book…it's in a log file.

Wednesday, February 16, 2011

The Brilliance of Microsoft + Nokia

microkia-better-workWhile most of the industry seems to be confounded by the recent Microsoft and Nokia announcements around Windows Phone, I think there is a brilliant Silverlining.

And rather than heap more narrative upon the piles that have already been written about this partnership, let's cut straight to the chase.

WHAT IS MICROSOFT'S PROBLEM

In a two words: hardware and apps.

Arguably, Microsoft has an innovative mobile OS with Windows Phone that is ahead of its time. But the hardware is lukewarm at best. The hardware partners for WP7 have all introduced devices that do little to differentiate from Android counterparts, and they have failed to rival the lust worthy industrial design of devices like iPhone 4 or Motorola Droid.

Meanwhile, as the hardware fails to draw consumers in droves away from the sexy gadgets available from Apple and various Google partners, Microsoft faces a chicken and egg problem. They need stronger adoption to motivate developers to strongly back WP7, but they need more apps to gain adoption. Partners like Telerik are helping with programs designed to spur early WP7 app development, but more fuel is need to turn these sparks in to a roaring marketplace and platform.

WHAT IS NOKIA'S PROBLEM

In two words: software and focus.

Everyone understands Nokia's software problem. After dominating dumbphones for years, Nokia failed to transition to modern smart phones fast enough to remain relevant. They have proven unable to move fast enough independently to solve their software woes without assistance.

As they struggle with software, that has led to some stumbling hardware designs. Saddled with an OS unable to support modern smart phone concepts, Nokia engineers have been producing phones that fail to impress.

WHAT MICROSFT AND NOKIA DO WELL

Despite their problems in today's smart phone market, Microsoft and Nokia are two industry veterans very familiar with the mobile market and loaded with "weapons" for a renewed mobile battle. Among their biggest strengths:

Microsoft brings:

  • The huge .NET developer audience that already has the skills to build WP7 apps (they just need more incentive)
  • Industry leading development and debugging tools (just compare the process of registering a WP7 dev device to Apple's iPhone dev device registration process for a good case-in-point)
  • A mature partner network and developer ecosystem, with vendors like Telerik already gearing-up to provide tools unmatched by competing platforms
  • A critical understanding that the future of Microsoft depends heavily on the success of WP7
  • Lots of cash

Nokia brings:

  • Unmatched hardware distribution channels. Nokia shipped more than 111 million devices in 2010, compared to Apple's 47 million and Android's 67 million.
  • Highly tuned supply chain (you don't ship 111 million devices without one)
  • One of the most valuable consumer brands in the world (Microsoft brings this, too)
  • With the ousting of internal software efforts, a critical understanding that they must build great hardware or die

MICROKIA: THE PERFECT MARRIAGE

Nokia and Microsoft may be operating from positions of weakness today, but they are the perfect example of two companies that are stronger together than independent.

With Nokia providing near exclusive focus on producing killer hardware, and Microsoft re-focused on improving upon its innovative mobile platform, "Microkia" (as the Microsoft + Nokia partnership has been dubbed) is positioned to start shipping devices by the end of 2011 that firmly leap-frog Android and maybe even iOS, which is starting innovate more slowly under the weight of its huge adoption. If Microsoft and Nokia combined can't make Windows Phone succeed, it never will.

THE MISSING CONVERSATION: TABLETS

Everyone (self included) has accused Microsoft of missing another cycle by failing to have a good answer for the iPad early this year. Nokia may be the godsend Microsoft needs to recover.

If Nokia is no longer investing significant energy in software, it has "nothing" to do other than focus on designing and building great hardware. Imagine a sexy Nokia tablet concept running Windows Phone 8 (the naming of the tablet OS gets a bit tricky…can't go back to Windows Mobile or Windows OS) by late 2011. If, and this is the big IF, Nokia and Microsoft can execute on these opportunities together, they can re-spark the excitement both companies so desperately need.

SURPRISE! THE ANALYSTS ARE WRONG

Many analysts and pundits seem to think Microsoft and Nokia are "screwed" because Android and iOS have sizable leads in the modern mobile world. Really? How much of a "lead" did RIM and Microsoft have when Apple hit the scene in 2007? Remember the headlines? How about:

In those articles, we find quotes from the same pundits and analysts dooming Nokia and Microsoft, like this choice insight from Forrester:

"The iPhone will not substantially alter the fundamental structure and challenges of the mobile industry."

Among the pundits arguments against Apple at the time? You got it. Apple is "too late" to the game. Sound familiar? That's one of the primary assaults launched against Nokia and Microsoft for not having the apps and hardware they need to compete on the market today.

Give it time. Give it 2011. Microsoft and Nokia are more focused than they have ever been on making Windows Phone succeed. The future of both companies depends on it, and they have the resources, focus, and ammunition to go to battle and win.

(SIDE NOTE: Remember Xbox? Another great example of Microsoft making a come-from-behind play for a market and toppling two well entrenched industry giants. Ironically, Xbox may now play a critical role in helping Windows Phone achieve similar success.)

WINDOWS PHONE IS GOLD

What should you, the developer, take from this lengthy analysis? If you're sitting on the sidelines with Windows Phone, rethink your position. Now is the time to get in ahead of the coming rush of excitement Nokia and Microsoft will create later this year. There will soon be an explosion of apps for Windows Phone and a wave of consumers to buy them; the next major mobile gold rush.

Telerik is clearly committed to helping you seize the opportunities of this gold rush by providing highly optimized tools for Windows Phone apps, so get started today. Or don't. Just don't be surprised when Nokia is shipping 60+ million Windows Phone devices and your app is missing.

Monday, February 14, 2011

Why not ORM: 5 ORM myths dispelled, Part 1

ORM-Robot Let's start with a DISCLAIMER: If you are already an active user of any ORM, this specific post is not for you. I'll talk to you later. For everyone else, let's continue.

In my role as a technical evangelist, I get the chance to travel the globe and talk to developer audiences on a regular basis. To keep a clear picture of how developers are working, I often informally poll audiences and try to listen for trends in development behavior. One trend that continues to stand out is how many developers still do all data access by hand!

What do I mean "by hand?" I mean manually creating and destroying ADO.NET objects (like SqlConnection and SqlCommand) to move data between apps and data stores. (This includes developers that use tools to simply auto-generate "by hand" code- that's just saving keystrokes.)

Does that describe you? Hopefully it does to a certain degree (otherwise you've overlooked and/or disregarded the DISCLAIMER). You need to stop. You need to reevaluate how and why you're building applications.

DON'T DEVELOP LIKE IT'S 1999

I'm going to talk primarily to web developers, A) because it's what I know best, and B) because I know many readers of this blog are just that. Think back to web development circa 1999 and good 'ol "classic" ASP. We've moved well beyond the days of those spaghetti code script pages, but let's illustrate how data access was commonly done:

Dim Conn
Dim SQLTemp

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.connectionstring =
 "Provider=Microsoft.Jet.OLEDB.4.0;Data
 Source=" & Server.MapPath("\database_name.mdb")& ";"
Conn.Open

SQLTemp = "SELECT * FROM table_name"
set rstemp=Conn.execute(SQLTemp)

Do While Not rstemp.EOF

rstemp.Fields("field_name").Value

rstemp.MoveNext
Loop

Conn.Close
Set Conn = Nothing
You created a connection object. You created a command. You executed it and looped through the results. And in an application working with lots of data, you did this over, and over, and over…
Fast forward to the modern .NET era. If you're still doing data access "by hand" (or having a tool generate code for you), you are probably doing some variant of this:
SqlConnection conn = new SqlConnection("connection string...");

SqlDataReader rdr = null;

try
{
   conn.Open();
   SqlCommand cmd = new SqlCommand("select * from Customers", conn);

   rdr = cmd.ExecuteReader();

   while (rdr.Read())
   {
       Console.WriteLine(rdr[0]);
   }
}
finally
{
   //Clean-up...
}
An improvement syntactically over VBScript, yes, but in concept it's the same old "naive" model for working with data: create connection, create command, execute and process results. Sure, you can wrap this in a pretty "framework"- you pass-in SQL, you get back a DataSet- but you're still doing pretty "raw" data access. There is no "software intelligence" helping you look for opportunities to lazy load data, optimize SQL, or cache data efficiently. That's all on you! There must be a better way.
 
THE MIGHTY ORM
 
Ah, ORM- that's Object Relational Mapper, for the uninitiated. Tomes have been written about ORM over the years, its benefits, its problems, its limits. Boil it all away and a good ORM (generally speaking) has a simple goal: make it easier to for developers to work with data. Data access is not rocket science. Information sitting in structured tables on disk needs to be retrieved and loaded in to memory for an application to do additional processing. Things get a bit harder when you introduce the real world complexities of a reliable, performant system. Data access needs to be fast, it needs to ensure data integrity, and it needs to be efficient so it doesn't "hog" server resources.
 
Still, these are well defined problem areas that don't change from application to application. These are the kinds of narrow, well-defined problems robots (i.e. software) are really good at solving. So that ultimately begs the question…
 
WHY DON'T YOU USE ORM
 
If there are tools, like ORMs, that make data access easier without compromises, then why would anyone (you!) continue to do data access by hand? I have some theories. I think there are some powerful myths surrounding ORMs that prevent hard working developers from realizing ORM benefits:
  1. MYTH #1: ORMs are difficult to configure, Learning curves are too steep
    A common myth surrounding ORM is that in the time it would take to configure and learn the ORM system, you can finish creating the data access you need by hand with time to spare. This myth earns its reputation honestly. In the early days of ORM, there were few options for .NET, and those that did exist, like NHibernate, did require some pretty gnarly XML configurating. But that was then.

    Today, .NET developers have a host of ORM options, some of which can have you up and running in minutes. Take LinqToSql or OpenAccess ORM. Both provide simple visual designers that let you easily configure an ORM data context in seconds. OpenAccess even provides wizards on top of the designer to further streamline the setup process. Entity Framework, while more complex, also offers a rich visual designer.

    CONCLUSION: Myth busted. The ORMs of today are easy to configure. If you're avoiding ORM because you remember the XML config days, it's time to look again.

  2. MYTH #2: I can't give-up Stored Procedures, and ORMs don't use Stored Procs
    I'll save the religious debate about the necessity of stored procedures for another day, but any ORM worth its salt today offers support for Stored Procedures. Some offer better stored proc support than others, but with a good ORM, you can "hydrate" (that's an ORM term that means initialize your model objects with data from your database) objects using stored procs and forego completely ORM generated SQL.

    CONCLUSION: Myth busted. Stored Procs are not an excuse for avoiding ORM.

  3. MYTH #3: It's difficult to keep the database and ORM in sync.
    A great myth, and true for simple ORMs like LinqToSql, but absolutely false for ORMs that provide powerful Visual Studio tools. Thanks to improved framework features, like partial classes, and improved tooling, like OpenAccess' wizards, the process of merging database schema changes in to your mapped ORM classes is no longer a frustrating "blow all your customizations away" event. In fact, tools like OpenAccess are powerful enough to go the other direction and merge changes in your classes back in to your database schema! How's that for developer power?

    CONCLUSION: Myth busted. It's not hard with modern tools and framework features to keep database and ORM code in-sync.

  4. MYTH #4: I can't optimize an ORM. I'm stuck with its data access decisions.
    This is true for many ORMs, but with powerful ORMs like Telerik's OpenAccess, even this is a myth for the past. Using simple configuration steps, you can give ORMs "hints" that optimize query plans in your application. Generating hundreds of SELECTs when loading a collection of objects? No problem. Specify a fetch plan and those hundreds of statements can be condensed in to one or two powerful SQL statements.

    CONCLUSION: Myth busted. True, some ORMs leave you hanging when it comes to optimization (like LinqToSql). But powerful, full-featured ORMs like OpenAccess even make optimization a simple process.

  5. MYTH #5: I don't trust the SQL that an ORM produces.
    The big one! I'd wager this is one of the TOP reasons developers like you avoid ORMs. You don't trust them. You don't trust the SQL they generate and you don't feel like you have a good idea how those simple design-time LINQ queries get expanded to "real SQL" at runtime. Sure, you can fire-up SQL Profiler (or the free AnjLab SQL Profiler Express) and try to see what's coming-out of your app at runtime, but that's inconvenient and can be difficult to analyze. I'd say this is the one myth that continues to trouble today's ORMs. Yes, there are commercial tools that can help with profiling, but out of the box, ORM is largely a "black box."

    CONCLUSION:
    Plausible. This myth presents a challenge that needs a solution. If you're going to stop doing data access by hand, you need to be able to peer-in to the black box and form a trust with your ORM.

GETTING PAST THE 5th MYTH

If lack of SQL transparency- which I think leads to a lack of trust- is one of the biggest barriers to ORM adoption, then it's the problem that should be solved. You should not waste days of your development life writing unnecessary data access code simply because it's too hard to peer-in to the ORM black box and form an understanding of what's happening. What do we need? We need an easy way to see what our ORM is doing. A tool that will help us easily find ways to optimize ORM behavior and establish a close working relationship so that you can focus on application development, and the ORM can focus on moving data.

In Part 2, I'll introduce a simple tool that I've crafted that will help you do exactly that for OpenAccess ORM. In the mean time, let's all agree to stop wasting time, get past our 1999 data access patterns, dispel the myths, and give ORM a try. And since OpenAccess ORM is FREE, why not start today?!

Tuesday, February 08, 2011

Troubleshooting OpenAccess ORM VEnhance errors

venhance-error

I'm working on what I promise will be a very cool and useful tool/demo for OpenAccess ORM (more on that very soon), and in the process I was reminded of some of the challenges that can pop-up when you start manually "enhancing" OpenAccess-enabled assemblies. Manual enhancing is something you usually do when your project configuration and build steps require maximum control, or when you're trying to use specific versions of the enhancer (VEnhance.exe) with your code. In other words, it's not something faced by every project, and new OpenAccess projects using the new DataContext are event less likely to require manual VEnhance steps.

Still, if you prefer the pre-visual designer approach to OpenAccess, or if you're maintaining code that uses a specific VEnhance version, here are a few quick tips that should help you quick resolve any build-time VEnhance crashes:

  1. VEnhance Config: If you're working with .NET 4, a common cause of VEnhance crashes is failure to include the "venhance.exe.config" file in the same directory as the "venhance.exe" executable. This simple config file is needed with .NET 4 to tell the enhancer to use use Framework v4 assemblies when enhancing your code. The contents of the config file are simply:
  2. <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <startup>
      <supportedRuntime version="v4.0"/>
    </startup>
    </configuration>
  3. VEnhance Version: Another common mistake is mis-matching VEnhance versions. That is, using a VEnhance version that is different from the version of the OpenAccess assemblies you're referencing. With the latest VEnhance versions, you can actually use a newer VEnhance.exe with older versions of OpenAccess, so just make sure you're using the latest VEnhance executable. If you find yourself in doubt, though, it can't hurt to make sure both your referenced assemblies and VEnhance version match.
  4. Supporting DLLs: The VEnhance tool needs a few external assemblies to do its magic, so make sure they are accessible by the executable (usually best kept in the same directory). If you are copying VEnhance.exe to a project-relative location (good practice for creating "upgrade proof" projects), don't forget to bring these files along: Telerik.OpenAccess.SDK.dll, (and in newer OA versions) Mono.Cecil.dll, and Mono.Cecil.Pdb.dll
  5. Manually Run VEnhance: Finally, if after checking your VEnhance version and making sure the necessary config file is in-place, you can always run VEnhance manually. The advantage to doing this instead of using Visual Studio post-build events is that you tend to get much more descriptive errors that help with troubleshooting (versus the totally unhelpful crash message pictured above). To manually enhance:
    1. In Visual Studio, select your OpenAccess-enabled project and set the project "Enhancing" attribute to "False" (disables IDE integration "auto" enhancing)
    2. Build your project (should build and do no OpenAccess enhancing)
    3. Open a command prompt in the directory containing "venhance.exe"
    4. Run the command "venhance <path to your compiled DLL>" (In newer versions of VEnhance.exe, it will be: venhance -assembly:"<path to dll>"
    5. Inspect the command prompt output for runtime errors or SUCCESS!

There are other options you can use with manual enhancing, too, like the "-verbose+" command combined with "-verboseMode:4" to see detailed output in the command window about what VEnhance is doing. If nothing else has solved your problem, this technique should at least tell you what's wrong.

Don't get stuck or frustrated with useless VEnhance Windows crash dialogs. Try these troubleshooting steps and get back on the road to using one of the most powerful and enjoyable ORMs available for .NET development!

Wednesday, January 26, 2011

WinPhone Webinar Series in February

windows-phone-7-logo-phone Interested in improving your skills (or getting started with) with Windows Phone 7? Then the Telerik WinPhone Webinar Series is where you want to be during the month of February. All month we will be offering special WinPhone focused webinars that help get you familiar with the WP7 platform and Telerik's newest tools designed especially for the new mobile operating system.

To help deliver a well-rounded, world-class set of webinars, we've invited two Windows Phone industry experts to host two of the events: WinPhone trainer extraordinaire Shawn Wildermuth and WinPhone fanatic Mark Arteaga. They will join Telerik Developer Evangelist and XAML preacher Evan Hutnick to host three info-packed, free, online events:

  1. Using RadControls to Build Windows Phone 7 Applications
    A primer on Telerik's new tools for WP7
    REGISTER: FEB 10th with Evan
  2. Developing for the Third Screen - Windows Phone 7
    A primer on Windows Phone 7 in case you're just getting started with the platform
    REGISTER: FEB 16th with Mark
  3. Consuming OData in Windows Phone 7
    A "next level" talk about working with data in WP7 apps
    REGISTER: FEB 23 with Shawn

All events start at 10 AM Eastern (here's a convenient time zone converter) and all will be recorded so you can re-watch them on Telerik TV. Register today so you don't miss-out on our month of Windows Phone webinars!

Tuesday, January 25, 2011

Vote for my MIX11 session

300x250_Mix11_011011_US_b One of my favorite Microsoft conferences takes place every spring in Las Vegas, and this year I may have an opportunity to speak at MIX11. If you've never been to MIX and you are a web developer (particularly, a "Microsoft web developer"), then you're missing-out on a great conference experience. Personally, if I had to choose between Microsoft-run events, I'd pick MIX over TechEd and PDC almost every time. It's not as big as some events, but it's high-energy, focused, and a great place to talk about all things web and design.

This year, I have the distinct honor of getting a session in to the MIX11 Open Call. As MIX goes, this is your chance as attendees (both physical and online, alike) to vote for the sessions you want to see at this year's event. So, if you're interested (or even if you're not), I'd love to have your vote for my session:

Doing More with LESS for CSS

It's a cool CSS3 talk with lots of practical tips for managing the ballooning CSS rules modern browsers offer. Picked or not, I appreciate your support and can't wait to see some of you in Vegas this April!

[By the way, voting ends February 4th, so cast those votes today!]

Thursday, January 06, 2011

Two New Microsoft MVPs at Team Telerik

MVP_FullColor_ForScreenI don't often get to brag about the accomplishments and hard work of the outstanding members on the Telerik Evangelism Team, but with the recent round of Microsoft MVP selections and renewals (thanks, by the way, Microsoft!), I thought I'd take a minute to recognize two people.

First, I'm proud to announce and introduce the newest Telerik Evangelist, Chris Eargle. Chris joins the Telerik Team as a well respected and prolific speaker in the .NET community, and an active holder of a Microsoft MVP award. Many of you probably already know Chris, but if you don't, be sure to say hi when you see him at your local DNUGs and check him out on his blog, KodeFuGuru, and on twitter, @kodefuguru.

Next, I'm also excited to announce that our very own XAML Evangelist, Evan Hutnick, has just been awarded a Silverlight Microsoft MVP. Congratulations to Evan on working tirelessly in 2010 to serve the XAML community (in addition to the Telerik community!). You can pat Evan on the back on his twitter, @evanhutnick.

Telerik has one of the most generous and hard working teams in the industry, and I'm happy their efforts are recognized by all. With more than 5 Microsoft MVPs and several Microsoft RDs on staff, Telerik stays well connected so that we can deliver the best possible products to you, our customers. If you ever need support for your community events, or have questions for our Microsoft experts and MVPs, don't hesitate to reach out. We're here for you and we have the awards to prove it!

Monday, January 03, 2011

5 Tech Predictions for 2011

Happy New Year! It's January 3rd, the first working day of 2011 for most of us, and a time of year when we can count on weight loss commercials to run like political ads on TV, and the Internet to collectively "predict" the major trends for the upcoming year.

I don't usually blog "predictions," though I do regularly make them. In reality, posts like this are little more than "permalinks" for debates that can be pulled-out to "prove" your infallible foresight in the world of tech when you make an even marginally accurate prediction. And much like industry analysts and their expert opinions, there are few consequences for guessing wrong. So, why not.

I will focus my predictions on developer related technologies and trends, especially in the Microsoft space. That is, after all, the audience for this blog, and hopefully an area I can lend the most perspective to help guide you towards the hot topics of 2011.

THE PREDICTIONS

  1. Standards-based web development will resurge on the back of HTML5
    I don't have to be much of a prognosticator to make this prediction, but there are definitely people I respect that would disagree. If you look at the wave of HTML5 browsers that will finally ship official versions in 2011 (specifically, IE9 and FF4, joining Chrome 9+ and Safari 5+), there were be a large, uniform foot print for HTML5 (and its related technologies, like CSS3) to blossom. Even the expanding usage of mobile internet will drive HTML5, as it provides the one and only "available everywhere" rich platform.
    I'm not predicting the death of plug-ins, but I do think they will take their battle to the desktop and leave the web to browser-driven standards.

  2. Silverlight will be rebranded as the defacto Windows APPlication platform
    To be clear, I don't think Microsoft will overtly rebrand Silverlight, but with the release of Silverlight 5, Windows 8 beta, updates to Windows Phone, and rumored Silverlight on XBOX in 2011, Microsoft will stop fighting to "light-up the web" with Silverlight and instead focus on its benefits as a rich, universal "app" platform for Microsoft environments. Along with this, WPF will get pushed even further to the back of the bus, remaining relevant for specific types of development, but not part of the "mainstream" conversation. Microsoft will push Silverlight as "the app platform" to help reduce the WPF/Silverlight confusion that has lingered for the last couple of years and simultaneously spur developer interest in creating apps for Phone and XBOX.

  3. Windows Phone will be 4th place by the end of 2011
    Windows Phone will be 4th by measure of market share by the end of 2011, driven largely by Enterprises interested in the familiar app development model and willing to give-up Blackberry for keyboard- and Outlook-equipped WP devices. We've already seen companies like Dell push in this direction (granted, they have a commercial motivation), and many others are reportedly re-evaluating their dependency on Blackberry.
    The powerful weapon Microsoft brings to this fight, one that Android lacks, is a mature, well-entrenched Enterprise sales team. Microsoft knows how to sell to Enterprise, so assuming the Phone can catch-up with critical features, they'll win many head-to-head battles with Google's alternative.
    And since I've opened the door with rankings, Android will be first, iOS will be second, RIM will be third (with a declining share), Microsoft will be fourth (with a rising share).

  4. The search for a "universal mobile app platform" will be a raging debate by mid-2011
    With Windows Phone, Android (and its fracturing), iOS, Palm OS, Nokia's MeeGo, Blackberry's upcoming QNX OS, and a handful of other "device" operating environments proliferating in 2011, developers and companies are going to finally start questioning the logic in creating custom versions of "apps" for every device. Think about it. It's worse than the "desktop wars" of nearly 20 years ago that originally spawned Java and ultimately gave rise to web applications. Three competing approaches to solve this problem will emerge in 2011: 1) Tooling will attempt to abstract the platforms for developers, producing native variants of a single app for multiple platforms, 2) Frameworks, like MonoTouch, will attempt to create an abstracted runtime layer that can be deployed to multiple platforms, and 3) a push for a return the rich web browser for many app types will move some app development back to HTML5 that works on all platforms. I think options one and three hold the most short-term promise, but more on that later this year.

  5. Mobile web development will be a must for all websites by the end of 2011
    Creating optimized versions of websites for mobile browsers today is already common for major websites, but by the end of 2011, it will be common practice for all websites. Aided by a better understanding and usage of CSS media queries, and driven by an unignorable volume of mobile traffic, web developers will be forced to provide some level of targeting for mobile devices for all websites they maintain.

Ultimately, I think it will be a good year for HTML5 and Silverlight in the developer space, and that mobile (whether that's tablet, phone, or something in-between) will be a big part of the conversation. What do you think? What's coming in 2011 in the developer space that I've overlooked? Speak now and claim your "told you so" link for 2012.

Also, check-out some 2011 predictions from my esteemed colleagues, Stephen Forte and Joel Semeniuk.

Tuesday, November 23, 2010

Q3 Webinar Week Wrap-up

q310-webinar-week Wow! Q3 2010 was huge by every measure. Tons of updates to the Telerik toolbox. Tons of new demos, blogs, help documents, and videos. And tons of you joined us for the Q3 2010 Webinar Week! Last week we hosted 9 live webinar events to help introduce you to the Q3 2010 bits, concluding with Friday's special event that showcased the Telerik tools working together, highlighting how the toolbox can make you productive at all points in the software development lifecycle.

If you were unable to join the live webinar week, or if you missed an event, don't worry! All of the live events were recorded and are making their way to Telerik TV right now. Catch any of the webcasts on-demand using these handy links:

If you saw Friday's Special Event, you may have seen Evan Hutnick's cool "Ad-hoc Silverlight Reporting" demo done with Telerik's Silverlight data visualization controls and rich text editor. If you want to try the code for yourself, it is available now (direct link to download).

Enjoy the over 6 hours of new Q3-specific video content, enjoy the upcoming holidays, and stay tuned for news about 2011 release plans! We never rest so that you can!

Thursday, November 11, 2010

Quickly update all Telerik product installs using PowerShell

powershell-telerik With the Q3 2010 release now available, the challenge of updating your dev environment with the new versions can sometimes seem daunting. After all, the Telerik Ultimate Collection now represents more than 10 products, and thus more than 10 installers. Add any virtual machines you maintain to the mix, and the challenge of updating increases. Fortunately, all Telerik products use MSI installers, and with a little PowerShell we can easily script the complete system update.

Updating Your Telerik Products in 2 Steps

With a handy PowerShell script I've created (available below), you can easily update any system to use all of the latest and greatest Telerik tools in 2 simple steps:

  1. Download all of the Telerik products you want to install
    • Place the MSI installers in one folder
  2. Download and run my Telerik Installer PowerShell script!

That's it. The script will automatically look for and uninstall old versions (pre-Q3) of Telerik tools and then install all of the products you've downloaded. By default, the script will look for the installers in "C:\Program Files (x86)\Telerik\Downloads\Q3 2010\", but if you'd prefer to use a different location, the script can be easily edited.

Run and done

The cool benefit of this script is that you can download your bits, run the script, and then go about your business while the uninstallers and installers run. No need to "babysit" your machine installing and uninstalling software.

On my primary machine (which has an SSD), the entire process took about 10 minutes: 4 minutes to uninstall everything and about 6 minutes to run all of the installers. On a VirtualBox VM running on an external USB drive, the process took about 35 minutes (15 to uninstall, 20 to install).

Regardless of the exact run time, it took exactly 30 seconds of my time to update my entire Telerik toolbox.

Enabling PowerShell Script Execution

If you've never run a PowerShell script, you may have a problem executing this script due to PowerShell's default security settings. To resolve the problem, you simply need to run a PowerShell command that allows script execution. Here's how:

  1. Open a PowerShell command prompt
    • Can be done via Start > All Programs > Accessories > Windows PowerShell
    • Alternatively, right-click my PS1 script and select "Edit with PowerShell"
  2. Execute the following command: Set-ExecutionPolicy Unrestricted
  3. A dialog will pop-up. Confirm your decision to change the execution policy.

Now you will be able to execute this script by simply right-clicking on the .PS1 file selecting "Run with PowerShell."

What about the Telerik Visual Studio Extensions auto-updater?

The Telerik Visual Studio Extensions (VSX) are awesome for updating your existing projects, or for updating individual projects directly from Visual Studio. The Telerik VSX tools can automatically check for newer versions of the Telerik tools, download the bits, and then update your projects. If you only work with 1 or 2 products, this is a great solution!

If you're like me, though, and you have everything Telerik installed (and, really, you should), it's generally easier to update everything at once with the installers for a major Q release. That's where this script comes in handy. Once everything is installed, you can still use the VSX tools to quickly update your projects to use the latest bits.

Side-by-side Installs

You can install many Telerik products side-by-side with older versions. This is sometimes useful when you have projects referencing different versions of the Telerik tools (though there are other options for "isolating" projects). While this script is configured to uninstall everything old, if you'd prefer to keep old versions, a simple script edit can help you skip the uninstalls. If this scenario becomes common, I'll provide a modified version with easy support of this option.

Download the Script

All that's left: Download the PowerShell script. Remember to edit the script if your installers are saved in a different folder. Otherwise, enjoy the simple system updater and feel free to send me feedback and ideas for improvement!

Wednesday, November 10, 2010

Q3 2010 is Live!

telerik-homepage

And just like that, Q3 2010 is live on Telerik.com! A slightly new and improved Telerik.com, at that. Today marks the official release of Telerik's final major update to the Telerik toolbox for 2010, and it is a huge release (as promised). More than 10 products get updated in this single release, so it's no small feat of both coordination and dedicated effort to continue to provide the most aggressive (some might say "agile") release schedule available from a professional software development lifecycle vendor.

By now, you've hopefully seen much of what's new in today's release, either in the pre-release blog series on the Telerik Blogs or in the "Live from HQ" videos here on Telerik Watch. We know it's a lot to absorb, so don't miss next week's Webinar Week, where we'll help introduce you to all of the new timesaving, developer rock-star making features and controls.

At a high level, here are some of the new things you'll find in Q3 2010:

  • AJAX
    • Two new controls: TreeList and Button
    • Improved SharePoint 2010 WebParts (for Grid and Editor)
    • Cool new Coverflow mode in Rotator
    • Built-in OData support in Grid
    • Progress indicator in AsyncUpload
  • MVC
    • Two new Extensions: TimePicker and DateTimePicker
    • RTL support and Section 508 / Level A accessibility conformance
    • Grid improvements (like column reordering and header templates)
  • WinForms
    • New control: CommandBar (replaces ToolStrip)
    • Grid improvements (lazy loading, Excel 2010-like filtering, new hierarchy modes)
    • Scheduler improvements (time zones, in-place editors)
  • Silverlight (WPF)
    • New theme: Expression Dark
    • New data visualizations: SparkLines and BulletGraphs
    • New control (WPF only): ScheduleView
    • RichTextBox improvements (Table support, spell check, export to PDF)
    • ESRI shapefile support in RadMap
  • Telerik Reporting
    • SQL Analysis Services Cube support (with new Cube Data Source)
    • XML Report Serialization (save your report definitions in XML files)
    • Interactive report drill-down
  • OpenAccess ORM
    • New converter: LinqToSql (more coming in the future)
    • Spatial types support, improved Fluent API, PostgreSQL support
    • New OpenAccess ORM SDK browser (very cool. check it out!)
  • JustCode
    • Unit Test Runner: Added MSpec support, improved speed
    • Lot's of NEW:
      • New Refactorings in C# and VB
      • New visual features (like structural highlighting, configurable visual aid size)
      • New quick fixes (like "Create Parameter" or "Create Field)
      • New code templates with quick Shift+Space access
  • JustMock
    • Many additional mocking scenarios now supported, like:
      • Mocking LINQ queries with custom selects
      • Mocking Castle ActiveRecord
      • Raising mocked events
  • WebUI Test Studio (Huge update!)
    • New in QA: Test Scheduling and Remote Execution!
    • Email notifications for test completion
    • New browser support: Google Chrome (and Safari 5 + IE 9)
    • New test step explorer (with support for conditional test step logic)
    • New (pretty!) test execution UI and visual test debugging

Phew! That's a ton- and that's a very light "summary" of Q3 2010. AND that doesn't include the recently introduced RadControls for Windows Phone and next week's updates coming to TeamPulse! Enjoy the Q3 2010 bits and remember to join us next week for the webinars.

Download the Q3 2010 bits

Q3 2010 Webinar Week, Register Now

q310-webinar-week 

Q3 2010 has arrived, and with it, TONS of new features and controls for you to wrap your mind around. If you received today's Telerik Newsletter, you also saw my new challenge for you: expand your horizons and try a Telerik tool from the Ultimate Collection you've not tried before (I'm guessing there's at least one). Telerik helps you be productive at more than just building UI these days, so I encourage you to discover how we can help you save time at the data layer, the business layer, during testing and QA, and even with project planning.

Since there is so much new stuff, and since I know you're taking-up my challenge right away, we're here to help you get started with another info-packed Webinar Week. There are two important things to know about this webinar week:

  1. It starts on Monday, November 15th
  2. There will be 2 webinars per day!
    • On Monday and Tuesday, it'll be the same webinar to help those of you in other time zones (like Australia and New Zealand)
    • For the rest of the week, it'll be two different events. More on that below.

Here's the schedule for next week's webinars. Click a link to register for the event.

  11 AM Eastern 10 PM Eastern
Monday What’s New in RadControls for ASP.NET AJAX, Extensions for MVC and OpenAccess ORM [REPEAT] What’s New in RadControls for ASP.NET AJAX, Extensions for MVC and OpenAccess ORM
Tuesday What’s New in RadControls for Silverlight and WPF [REPEAT] What’s New in RadControls for Silverlight and WPF

And for the rest of the week:

  11 AM Eastern 2 PM Eastern
Wednesday What’s New in RadControls for WinForms and Telerik Reporting  
Thursday What’s New in Telerik JustCode and Telerik JustMock What’s New in Telerik TeamPulse
Friday What’s New in Telerik WebUI Test Studio SPECIAL EVENT! Getting the most out of Q3

Don't miss Friday's special event! After a week full of product highlights, the Telerik Evangelists and Developer Support Specialists will come together and show you some cool integration demos and ways to use the Q3 2010 products together. It's a great way to wrap-up your week.

Of course, there will be prizes for attendees of each webinar. The more events you attend, the more chances you have to win, so register today and join us next week for the Q3 2010 What's New Webinar Week!

Tuesday, November 09, 2010

Q3 2010 Special: Live from HQ with more AJAX

Q3 2010 bits are less than a day away from your Account Downloads, and I know you're now teeming with excitement to get your hands on many of the cool things we've seen in the Live from Telerik HQ video series. I've got one more video to share, and this one is fun! I visit with one of the RadControls for ASP.NET AJAX Team Leads and he shows-off some very cool new features coming to the AJAX tools in Q3, like the new RadButton control and the new Coverflow mode in RadRotator. Check-it out and then make time to download everything Q3 tomorrow!

Watch the Ajax video in full HD on Telerik TV

Did you miss any of the Live from HQ videos? Don't worry! They're all available as a convenient video series on Telerik TV. Check-out all of the interviews and start putting faces with some of Telerik's technical product leaders.

Q3 2010 Special: Live from HQ with Reporting

We are less than 24 hours from the big Q3 2010 release, and I've got two more quick interviews Live from Telerik HQ to share. This time, we visit with the Telerik Reporting team for an overview of cool new features coming in Q3 (like XML Report Serialization, native Silverlight 4 printing, and the new Cube Data Source). This is a big release for Telerik Reporting and a great time for you to check it out if you're looking for basic BI in your .NET apps. Enjoy the video and stay tuned for the last soon!

Watch the reporting interview on Telerik TV in full HD

Monday, November 08, 2010

Q3 2010 Special: Live from HQ with ASP.NET MVC

Q3 is getting closer! We wrap-up today's interviews with a quick visit to the Telerik Extensions for ASP.NET MVC team. In this video, I visit with Senior Front-end Developer Alexander Gyoshev who shows us how the Telerik Extensions make it easy to embrace accessibility standards in ASP.NET MVC applications using the Telerik tools. Come back tomorrow for our final two interviews with Telerik Reporting and more ASP.NET AJAX!

Watch the ASP.NET MVC interview in full HD on Telerik TV

Q3 2010 Special: Live from HQ with Silverlight

Only three days to go 'til Q3 2010 is officially here! I know the wait is excruciating, but to help you pass the time I have 4 more Live for Telerik HQ interviews to give you a glimpse in to what's coming. We kick-off this week's interviews with a quick update from the RadControls for Silverlight, where we see how the new virtualized data source is going to enable new levels of performance when binding to large data sets. Enjoy the video and keep your browsers locked-in here for more Q3 updates!

Watch the Silverlight interview on Telerik TV in full HD

Did you miss one of the interviews posted last week? Don't worry, they're all available in the Live for Telerik HQ video series. So far, there are Q3 2010 interviews with JustCode, ASP.NET AJAX, OpenAccess ORM, WinForms, and Silverlight.

Friday, November 05, 2010

Q3 2010 Special: Live from HQ with WinForms

One more Live from Telerik HQ interview to hold you over the final weekend before the Q3 2010 release bits are available. This time I visit with the RadControls for WinForms team for a very quick overview of what's being prepared for Q3. Meet the Team Lead for WinForms, Tsvetan Raikov, and put a face with another one of Telerik's technical product leaders. Enjoy the update and stay tuned for more on Monday, starting with Silverlight!

Watch WinForms video in full HD on Telerik TV

Q3 2010 Special: Live from HQ with OpenAccess ORM

Q3 2010 continues to draw closer, and with it, more interviews Live from Telerik HQ. This time I visit with the OpenAccess ORM team to learn about improvements in Telerik's data access product for Q3 2010. The team shows-off the new SDK Browser and talks about new things coming to OpenAccess like an expanded Fluent API and improved Visual Studio designer. Stay tuned for more interviews with the technical teams at Telerik! Next up, WinForms!

Watch this video with the OpenAccess team in full HD on Telerik TV

Thursday, November 04, 2010

Q3 2010 Special: Live from HQ with ASP.NET AJAX

Video two in the "Q3 2010 Special: Live from Telerik HQ" series. This time, I visit with Stefan Rahnev, Unit Manager for the ASP.NET AJAX, ASP.NET MVC, and Visual Studio Extension teams at Telerik. Stefan shows-off the new RadTreeList for ASP.NET AJAX and shares some other Q3 details, too. Enjoy the video and stay tuned for more Live from HQ as we continue to approach Q3!

Watch the full HD version of this ASP.NET AJAX video on Telerik TV