Friday, June 12, 2009

Silverlight 3 and IE 8 Compatibility – Silverlight Control Not Sizing

I ran into an interesting issue with IE 8 and Silverlight 3 today.  We recently switched over to Silverlight 3 to start testing for the upcoming upgrade.  The Silverlight 3 conversion went pretty smooth and it all worked in the test website we are using in the Silverlight solution.  However, once we moved it to QA the sizing of the ASP.NET Silverlight control was not correct.  It kept cutting the Silverlight stuff short.  Not sure what the deal was, but I was able to fix it by wrapping the ASP.NET Silverlight Control in a div tag.  Wraping the control with this div will get it working but I’m not sure if it is a long term fix.

<div style="position:absolute;top:0px;left:0px;right:0px;bottom:0px;">

</div>

Friday, April 10, 2009

SQL Server and .NET Virtual Conferences

I 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.

Tuesday, March 24, 2009

Extending the ADO.NET Entity Framework

Last 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:

EFDemoes.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.

Wednesday, March 18, 2009

XRM Taking Off

At Colorado Technology Consultants (CTC) we do quite a bit of work with MS Dynamics CRM.  One of things Julie and David Yack are big on is the concept of XRM.  If you are not familiar with it, it extends the Customer Relationship Management side of MS CRM to any kind of Line of Business application.  MS CRM is a very customizable product and can be extended to be used for many non CRM type applications.

That being said CTC is kind of the XRM gurus right now.  Dave’s book on the subject is actually being used on MSDN in some places as reference material.  You can purchase the entire book, including a usable .NET framework that comes ready to use with the book, here.  Julie is starting up an XRM Virtual User Group that will consist of monthly Live Meetings related to the XRM space.  The user group site is actually built on top of MS CRM Live and hosted on Azure in the cloud.  Please visit the site to check out an impressive display of XRM and to register with the group.

XRM is becoming one of the hot Dynamic products.  So, you next step is to attend the XRM Virtual User Group meetings and learn how to use XRM to solve your software needs.

Tuesday, March 10, 2009

Iterating Through a Collection Using Reflection

I ran into an issue today using reflection.  I was getting properties on a object using the following code:

   1: Type argsType = args.GetType();
   2: PropertyInfo piResults = argsType.GetProperty("Result");
   3: object result = piResults.GetValue(args, null);

This works great if the object you are trying to retrieve is just a simple object.  However, what if the object in question is a collection of some sort?  This does not work because the results of type object are useless.  The key to solving this issue is to use the IEnumerable interface.  Here is the code to solve my issue:

   1: Type argsType = args.GetType();
   2: PropertyInfo piMessageList = argsType.GetProperty("Result");
   3:  
   4: IEnumerable Messages = (IEnumerable)piMessageList.GetValue(args, null);
   5:  
   6: Type objType;
   7: PropertyInfo objResults;
   8: foreach (object thisMsg in Messages)
   9: {
  10:     objType = thisMsg.GetType();
  11:     objResults = objType.GetProperty("Message");
  12:     Processmessage(objResults.GetValue(thisMsg, null).ToString());
  13: }

Notice on line 4 I’m casting the results from the GetValue method to an IEnumerable.  From there I can run through the objects and use reflection to pull out the individual properties.  Not the cleanest approach, but it works well if you are in a situation where the type of your results are not known to the consumer.

Friday, March 06, 2009

Circular Reference Error in Silverlight

I’m working on some demo projects for some presentations I’m doing for the Spring SSWUG .NET Development Virtual Conference.  More on the conference later.  While working on the demo code I ran into an issue when trying to reference one of my base classes.  I kept getting an error related to a circular reference.  I checked all my references in both projects and could not find the issue.  Finally, David Yack gave me a pointer that fixed my problem.  It was a problem with the project dependencies.  To fix this you need to change the dependencies.  To change the dependencies right click on the solution and select “Project Dependencies”.

ProjectDependencies

Make sure that the project you are referencing does not have a reference to the current project.

Wednesday, March 04, 2009

LINQ : The DBA vs the Developer

At 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!