Server Side and Client Side Caching with .NET and the Microsoft Sync Framework
Posted On Wednesday, June 30, 2010 at at Wednesday, June 30, 2010 by Ben HI recently presented at the Denver Visual Studio User Group on this topic. The approach I took was to start with an out of the box working Silverlight application and then tweak to using caching for performance reasons. The next step is to persist that cache on the client side to make it even faster and not even require a round trip to the server. After that I took it even further by saving the entire data structure to isolated storage to allow offline use of the application using the out of browser option of Silverlight. Finally I expanded it even further by turning it into a WPF application that stored the data in a local SQL Server data base that was synced back to the server using the Microsoft Sync Framework. To me this is a pretty natural progression of an application. Build the prototype and then tweak it through different phases to expand it’s capability.
While building these demos I had to refactor a bunch of things through the progression of the changes. This again to me is very natural. I find that if I start by simply solving the problem the pieces of the system that need to be refactored and extend become crystal clear in the end. Where as if I try to architect the application for every possible future change I tend to end up with an over architected system. Again keep it simple and refactor later.
I think we all know caching is an essential part of almost every web based application. That was the gist of the first part of the presentation. The last part showed some of the pros and cons of the Microsoft Sync Framework. There is some great documentation around this framework here. If you are new to the sync framework I suggest taking the time to read through a couple of these docs to understand how it works. My slides also contain some of information regarding the sync framework. My personal take on it is it is pretty easy to get started with. The issue I have is what happens when you get errors. Synchronizing two data sources is by nature a difficult process and errors will occur. Using this framework is kind of like using a black box. You sometimes want more control than you are going to get. Bottom line if I was looking to sync multiple data sources I would start with this framework. It is a no brainer to get started with and provides a ton a cool functionality. However, if I started having issues I might revert back to my old ways of just building a sync tool for my own need.
I had a great time presenting and putting together this talk. Below is a link to the slides and the completed solution if you are interested.
Design Patterns and Best Practices Using the ADO.NET Entity Framework
Posted On Saturday, March 20, 2010 at at Saturday, March 20, 2010 by Ben HThe last session I taped was a demo filled session on how to create a robust multi-layer application using the ADO.NET Entity Framework as the data access layer strategy. Entity Framework is not perfect. However, it is a great starting part that allows for extensibility that makes is a nice part of an application’s architecture. EF 4.0 has taken great strides and gives the developer total control of the generated code via T4 templates. This session contain less than 10 slides and pretty much 40 minutes of demos. If you are interested in watching this session please sign up to attend the virtual conference. The cost is minimal ($190) and the ROI will be huge. Check out a list of all the great sessions and register at www.vconferenceonline.com. You can get a $30 discount if you use my VIP code of BHOELTINGSPVC10. Enjoy!
Building a Multi-Page Silverlight Application
Posted On at at Saturday, March 20, 2010 by Ben HI also finished taping my Silverlight session. In this session we start from scratch with building a Silverlight navigation application. We walk through setting up the URI mapping to provide deep linking. We also wire up some data that the deep linking will use to look up data based on the link. This is a great session for anyone thinking about using Silverlight to build a multiple page applications. If you are interested in watching this session please sign up to attend the virtual conference. The cost is minimal ($190) and the ROI will be huge. Check out a list of all the great sessions and register at www.vconferenceonline.com. You can get a $30 discount if you use my VIP code of BHOELTINGSPVC10. Enjoy!
SQL Server and .NET Virtual Conferences
Posted On Friday, April 10, 2009 at at Friday, April 10, 2009 by Ben HI am happy to say I am presenting at the Spring ‘09 SSWUG.ORG .NET vConference on April 22, 23, 24. I recorded my sessions earlier and I’m please with the results. If you are not familiar with the vConference format you can get a 10 minute sample of one of my presentations here. The cost of the conference is only $125 and since it is a virtual conference there are no additional expenses. There really is some great content presented by outstanding presenters. Here is the link to check out all the SSWUG vConferences going on:
https://www.vconferenceonline.com/upcoming.asp
I also wanted to point out a free event that is going on Friday, April 17th. Here is the link to the free event:
https://www.vconferenceonline.com/shows/spring09/sql/s09event.asp
I will keep this blog updated with my content and slides once the conference begins.
Extending the ADO.NET Entity Framework
Posted On Tuesday, March 24, 2009 at at Tuesday, March 24, 2009 by Ben HLast night I gave a presentation on the ADO.NET Entity Framework at the Denver Visual Studio User Group. It was a great discussion and the questions from the audience helped me tell the story I was trying to tell. That story is that the Entity Framework is a great data access tool. It’s extendable and in turn flexible enough to meet the needs of the small point solutions to the enterprise caliber solutions. What I really like about it is the ability to start simple. Let’s get a solution up and running and then go back and extend\refactor certain areas to improve the architecture and\or performance. That’s not saying we shouldn’t do some design work up front, but let’s start by getting a solid solution built and then add on features and improvements in the future.
Sometimes I think architects focus too much on creating the perfect architecture instead of creating a flexible one. The solution just needs to work given the current requirements. Beyond that, it also needs to be flexible so it can change when new requirements and features get defined. EF lends itself very well to flexibility and extensibility.
The zip file below contains the final solution. That solution has all the extensions we did to the context as well as the entities in the context. It also includes a basis for a validation framework. The validation framework could use some tweeks to make it better. I leave that to you and your creative minds.
The zip file also contains a SQL script that will quickly and easily create the sample DB for you. Both the schema and the data. All you need to do is change the location of the DB file (.mdf) and the log file (.ldf) in order to run the script. Once you get the DB created you will have to change the server name in the connection string located in the web.config. After that everything should run great. Here is the zip:
I hope that you enjoyed the talk. If you would like the step by step guide to creating the initial model and setting up the inheritance please visit Rob Bagby’s blog of EF.
LINQ : The DBA vs the Developer
Posted On Wednesday, March 04, 2009 at at Wednesday, March 04, 2009 by Ben HAt the Rocky Mountain Tech-Trifecta Eric and Johnson and I did a session related to this topic. David Yack wanted us to do something that he could use to promote the session during his keynote. So, we went over the top and created this video. Enjoy!
Rocky Mountain Tech-Trifecta : A Week Later
Posted On Monday, March 02, 2009 at at Monday, March 02, 2009 by Ben HIt’s been a week since the Rocky Mountain Tech-Trifecta and I’m still getting caught up and processing everything that I learned there. I presented a couple sessions and I also attended a bunch of sessions. Fun stuff. I think the event was huge success. Thanks to my employer Colorado Technology Consultants, Inc. for letting me spend so much time volunteering for the event. A special shout out to Julie Yack for all the time and effort she put in. Please visit her blog at http://julieyack.blogs.com for a couple cool pictures from the event as well as some fun facts.
As stated above, I did two sessions at the Tri-Fecta. The code and slides are below. Please email me any questions or comments to benh@coloradotc.com. You can also catch up with me on Twitter. My handle is benhnet.
Thanks again to everyone that volunteered, organized and attended.
Updated 3/3/2009: I forgot one of the projects being referenced in the Design Patterns for UX. I have updated the link so please download the project again and it should work.
.NET Events in Colorado
Posted On Wednesday, January 28, 2009 at at Wednesday, January 28, 2009 by Ben HI know January is almost over, but to me the year is still new. I wanted to inform everyone about all the awesome User Groups and Community events in Colorado.
One of the most exciting upcoming events is the first ever Rocky Mountain Tech Tri-Fecta on Saturday, Feb. 21. I cannot explain how cool this event is going to be! It’s basically an all day geek fix. There will be sessions related to .NET development, SQL Server and Windows Server. So, if you work with MS products or know someone who does this is the event for you. We have tons of speakers (Scott Hanselman is coming!) from all over the country and many who work for Microsoft and have inside info you cannot get anywhere else. If you like what you are hearing please be sure visit the www.rmtechtrifecta.com site to register for the event to reserve your spot.
Next I wanted to let people know about the South Colorado .NET User Group. I have taken over the leadership of this group from Julie Yack. Julie Yack, David Yack and David Milner round out the leadership team for this group. Next Tuesday we have Kathleen Dollard coming down from Ft. Collins to talk about rethinking Object Orientation. SHould be great! Please check out the link above to get more details.
Here are the links to all the MS related user groups I can think of in Colorado.
Denver Visual Studio User Group
North Colorado .NET User Group
Colorado Springs SQL Server User Group
Colorado Springs Windows User Group
Rocky Mountain Windows Technology User Group
Please let me know if I missed a group.
XAML Data Binding Slides and Demos
Posted On Wednesday, December 03, 2008 at at Wednesday, December 03, 2008 by Ben HLast night I presented at the South Colorado .NET User Group. The discussion started with XAML data binding basics and then went into some more advanced topics. I basically covered how to bind to any back end data source I could think of including the ADO.NET Entity Framework. I also covered some style and UI topics. It was a fun discussion and I think my point regarding the power of data binding in XAML and WPF was made. I have uploaded a zip file of the slides and demos. The link is below:
http://www.htechinc.com/files/XAML%20Data%20Binding%20With%20WPF.zip
I also mentioned a cool add in for Visual Studio called XAML Power Toys developed by Karl Shifflett. Here is the link to XAML Power Toys:
http://karlshifflett.wordpress.com/xaml-power-toys/
If you have any questions regarding either of these links please let me know.
.NET Framework 3.5 Enhancements Training Kit and AJAX History
Posted On Sunday, November 16, 2008 at at Sunday, November 16, 2008 by Ben HI've been meaning to blog about this for awhile now. If you have not checked out the .NET Framework 3.5 Enhancements Training Kit, you should. It has documentation and tutorials on the cool new features in the 3.5 Framework including: ASP.NET MVC, ASP.NET Dynamic Data, ASP.NET AJAX History, ASP.NET Routing, ADO.NET Data Services, ADO.NET Entity Framework, WCF 3.5 SP1, and the .NET Framework Client Profile. You can download the training kit here.
One enhancement that we are interested in at work is the AJAX History enhancements. This is cool because it enables AJAX to use browser history. In the past when you used AJAX to do a post back on a section of your web page, that post back was not captured by the browser history. So, users could not use the back functionality of their browsers to get back to before the AJAX post back. The new AJAX History features allows us to configure the page to use browser history. It's pretty easy so if your interested just download the training kit and walk through the tutorial. It takes 15 - 30 minutes and you will be ready to go.
Enjoy! Let em know some of the cool stuff you find with the training kit.
Entity Framework And Tables With No Primary Keys
Posted On Thursday, November 13, 2008 at at Thursday, November 13, 2008 by Ben HOK, I think we can all agree that having tables without primary keys is a bad idea. However, sometimes we are forced to use backend databases that have multiple design flaws. In fact, database design flaws are one of the very things the Entity Framework (EF) can fix. EF allows us to fix issues we find in a database without actually effecting the database schema at all.
Anyway, yesterday I added a table to my EF model that had no primary key. I was surprised to learn that EF decided that since there was not a primary key it would just use all the non-nullable columns as a concatenated primary key. This might not be what you want.
To fix the issue, I had to hack the XML and remove the keys from the table definition. I was not able to fix it using the UI in Visual Studio 2008 SP1. Instead, I had to right click the model file in the solution explorer and select "Open With...". From there select the XML Editor. Then you just need to find the table definition and remove the unwanted columns from the primary keys section. It's a bit of a pain, but it is the only fix I know of at the time.
Let me know if you find a better solution.
Virtual Conference Day 3
Posted On Friday, November 07, 2008 at at Friday, November 07, 2008 by Ben HToday was another great day at the vConference. I attended some great sessions over the course of these three days and now I'm excited to go back and watch the ones I missed on demand. I hope everyone had as much fun as I did with the conference!
I did finally get my hosting situation figured out. That means I can get my slides and demos out here for people to download. I do believe that the vConference site will have this stuff posted eventually, but in case they don't here you go:
SharePoint:
.NET:
Virtual Conference Day 2
Posted On Thursday, November 06, 2008 at at Thursday, November 06, 2008 by Ben HDay 2 of the conference was just as good as day 1. We had great sessions all day long. I attended a bunch of the sessions and had some great conversations with many of the attendees. One of the issues we ran into today was the demos where not available. I was going to post them here, but I'm having some issues with my ISV and getting the files to the server. I will post them ASAP.
In the mean time, enjoy the rest of the conference.
Virtual Conference Day 1
Posted On Wednesday, November 05, 2008 at at Wednesday, November 05, 2008 by Ben HDay one of the Virtual Conference is over. It was a good day. We had dueling Dynamic Data Presentation going on from David Yack and Rachel Appel. If you missed one go to the on demand section of the conference and watch the other. After watching both of these sessions you can become an expert on Dynamic Data.
I also attended many of the other session. Rob Bagby did a great Rest session and Scott Golightley did an awesome WCF session. Kathleen Dollard gave two great sessions and Tim Heuer got us started with SilverLight. Not to mention a killer Keynote delivered by yours truly.
And all this was just the .NET Conference.
I also delivered my two sessions on SharePoint and Line of Business applications. These were with the SharePoint conference. Again, if you missed it please check it out on demand. If you have any questions please direct them to me. I'd be happy to help.
Tomorrow I deliver my two sessions on WPF data binding. Please check them out. It's also not too late register and attend. You would also get access to all the on demand sessions from day one. Here is the link to the registration and my discount code.
Enjoy!
PDC is awesome but... Don't forget the Virtual Conference next week.
Posted On Monday, October 27, 2008 at at Monday, October 27, 2008 by Ben HThe PDC is a great place to get the latest news related to Microsoft Technologies. It's a good idea to keep up to date with what is going on in the world of Microsoft. However, most of the stuff released and demoed there is bleeding edge stuff that won't be available for live deploys for months or even years. That's where the SSWUG.org Virtual Conferences being held next week come in. Three days of great content, most of which can be used in the applications you are building right now and can be deployed TODAY!!! Four conferences are being held that include: SQL Server, SharePoint, .NET and BI. Not only is it great content, but's it's only $100!!! Or if you use my discount code you can get it for $90. My discount code is:
SPVIPBH
Please use this code to save yourself $10 and go have a burrito at Chipotle on me. Mmmmm Chipotle.......
.NET Developer Virtual Conference - Update 9/30/2008
Posted On Tuesday, September 30, 2008 at at Tuesday, September 30, 2008 by Ben HJust wanted to update everyone on a couple of things related to the .Net Virtual Conference. In my previous post, I explained the idea of the conference and discussed all the great content that is available. In these hard economic times, getting access to this type of content for $100 is a great opportunity to save some money without compromising the bottom line. Well, things have gotten even better! Announcing a change to the .NET Developer Virtual Conference. Now the .NET Developer Virtual Conference also provides access to the SharePoint, Business Intelligence and the SQL Server virtual conferences. Read the details here. Now you pay the same price ($100) and get access to over 120 session. Pretty awesome. PLEASE NOTE THE DATE CHANGE FOR ALL CONFERENCES. THE CONFERENCES WILL NOW OCCUR ON NOV. 5th, 6th and 7th. Here is the registration link. Do not miss out on this opportunity to be in the know!
On a personal note I recorded my sessions last week and I think they went pretty well. My WPF talks are not the flashy, shiny WPF sessions you've seen in the past. These sessions will help you with the actual guts of doing a useful WPF application. Leave all that flashy, shiny stuff to those artsy designers and their black turtlenecks.
I was also subjected to an interview that was posted by Chris Shaw. If your interested in my answers to the tough questions in the interview please click here. Please do not be scared away by my ugly mug at the top of the article. If you look around on Chris Shaw's blog you will find some of the interviews with the other presenters.
.NET Developer Virtual Conference : Oct. 28 - 30
Posted On Wednesday, August 20, 2008 at at Wednesday, August 20, 2008 by Ben HJust wanted to let everyone know that I am lucky enough to be a presenter at this years SSWUG.org .Net Developer Virtual Conference in October. This is a really cool idea where all the sessions are pre-recorded and on the days of the conference you can login and watch from the comfort of your ergonomically correct cubicle chair. Maybe you can talk your boss into giving you the days off and you can watch in your PJs from your couch. Either way you don't have to incur the time or the cost of traveling to an in-person conference. This is a plus for those of you that are "Dungeon" coders. You can get all the great content of the conference without leaving the "Dungeon" and being forced to socialize with other people. That can be uncomfortable...
Seriously, there is some great content from some of the top presenters in the industry on deck for this conference. I'm just glad I get a free login so I can attend some of the other presenters sessions. Speaking of cost, you get all three days for just $100. If you can't sell this to your boss you're never getting any training EVER.
Again there are some great topics and presenters so please use this link to check out the sessions and the presenters for this conference:
.NET Developer Virtual Conference
There are also 3 other Microsoft related virtual conferences scheduled for the fall. Use this link to find out about all the conferences from SWWUG.org:
Are ADO.NET Datasets dead?
Posted On Wednesday, July 30, 2008 at at Wednesday, July 30, 2008 by Ben HIf you are plugged in at all to the Microsoft world you have been seeing more and more LINQ and ADO.NET Entity Framework buzz. You can't go to a conference or attend a User Group meeting without discussing one of these new data access technologies. I'm not saying that's a bad thing... Unless you are a Dataset, Datatable or Dataview.
I wrote a post back in May trying to shed some light on when to use which technology. You might want to read that post and the comments before reading on. In that post I stated that if you are creating new applications or just adding on features to your current app I would use LINQ or EF instead of ADO Datasets. There are many reasons. Here are the most compelling reasons to use LINQ and EF.
- Objects - The nicest thing about LINQ and EF is they provide some of the foundations for Object Oriented programming. They literally force you to think and work in terms of objects and collections of objects instead of rows and tables of rows. By setting up this foundation, these technology allow for the application to grow and use some of the more complex OO concepts without doing tons of work to fill and save objects from Datasets. So, start simple and as the requirements on your application change you can use some more complex OO topics to solve those problems.
- Memory - There are two schools of though on this topic. Some people like to pull all the data back into memory and then work with it there. Others don't like to fill memory with data that might not ever be used. LINQ and EF allow for both. When you build your LINQ and EF models you can use stored procedures same as you used to with Datasets and bring back the whole table if you desire. Or you can use the LINQ syntax to do filtering and sorting, which uses the power of the relational database engine to get only the row(s) you need. To me it is compelling to have the flexibility that LINQ and EF give me.
- Performance - We can go round and round about the performance implications here. People say stored procedures are faster because they are pre-compiled, but with the new technologies these LINQ queries are cached and optimized and the difference is often minimal. To me this is the 80\20 rule. 80 percent of my queries will run the same or faster in LINQ and EF than they do in a SP. The other 20 percent of my queries will run faster in stored procedures. So, use both. LINQ and EF allow for using SP or the LINQ syntax. Plus, with LINQ you can bring back only the columns you need which can improve performance as well. I'm not saying quit using stored procedures, but instead of just blindly using them because that's what you've always done, step back and analyze your requirements to see if it's worth it.
- Interop with Other Object Collections - The other benefit of working with LINQ and EF is that you can join your data objects with other object collections. If you've seen my talk on LINQ and the demo related to joining my SQL data with file data retrieved using the System.IO objects. It is so easy and would require lots of work with Datasets.
There are many more reasons out there, but these are a few of the ones that are most important to me. Any one else want to add?
I never knew Software Architecture was a Democracy
Posted On Friday, June 27, 2008 at at Friday, June 27, 2008 by Ben HI always thought it was a dictatorship run by Microsoft. I came across this article about "A vote of no confidence" in the ADO.Net Entity Framework this morning. I recommend spending some time reading the article and also following all the links to other related articles. The issues are great concepts to understand.
I'm not going to get into the specifics or defend one side or the other. However, I want to express my position that there are 100 ways to skin a cat, or in this case architect a software application. So, if you don't like the EF V1 don't use it. If the issues being discussed are important to you and effect your application then by all means use whatever ORM or data access technology you like.
I joked about software architecture being a dictatorship, but the bottom line is will the end user care if you used EF, NHibernate or straight ADO.Net Datasets? Probably not as long as the system works. So in the end it is a dictatorship. You (or your team) and only you decide what architecture to use. However, keep in mind you are also the one that has to make it work and scale.
Data Access Technologies - Should I use ADO, LINQ, nHibernate or the Entity Framework?
Posted On Tuesday, May 20, 2008 at at Tuesday, May 20, 2008 by Ben HI came across this blog post today that explains the differences between these data access technologies. However, it does not give a definitive answer on when to use which technology. That's because it depends on so many factors. My advice is to keep it simple.
Let me expand on the different technologies and provide some guidelines on when to use them:
Classic ADO.Net - In my opinion ADO.Net is a dying breed. As a developer you need to know it for maintenance purposes, but any new features or products should be designed using LINQ or EF\nHibernate. Some people might not agree with me here, but again this is my opinion. The only caveat is to make sure the target environment supports the 3.5 Framework. If the systems people will not let you install 3.5 on the server or end user's machine then LINQ and EF will not work.
LINQ (LINQ to SQL) - As the blog post on this states, LINQ currently only supports SQL Server. There are tons of open source projects that do LINQ to other things, but the only MS supported database backend is SQL Server. For many of us, that is just fine. If you know you need to support other DB platforms you can move on to EF\nHibernate now. If you're pretty certain the only DB backend is going to be SQL Server then the decision between LINQ to SQL or EF\NHibernate comes down to architecture. EF\nHibernate are full blown ORM tools, meaning they include many additional features (Inheritance, complex types, multiple data sources, etc) over and beyond what LINQ to SQL provides. So, if you are using SQL Server and the application design is not overly advanced or complex. I'd use LINQ to SQL.
EF\nHibernate - I lumped these two tools together because they are both ORM tools. They provide support for many advanced and complex concepts in software design. Using these advanced features is great if you are building a large enterprise, public facing or consumer use application. However, for many applications these tools can be overkill and end up taking too much time to design. That being said there is one thing that often gets overlooked, the fact that you can use these tools to do one to one mapping similar to the way LINQ to SQL does. So, if you need to support mulitple DB backends, but you don't want to use the advanced features you can do so.
In summary, if you are building a simple application that is going to use SQL Server as the DB backend, use LINQ to SQL. If you are building a simple application that needs to support a DB backend other than SQL Server, use EF or nHibernate and do one to one mapping between your entities and your DB tables. If you are building a large application that requires some complex architecture, use EF or nHibernate. Don't use ADO.Net for any new projects unless the target environment does not support the .Net 3.5 Framework. However, I don't think it is necessary to go back and rip out all your ADO.Net code and replace it with something else. Just be patient and use the new stuff with new projects.