Silverlight 3 and IE 8 Compatibility – Silverlight Control Not Sizing
Posted On Friday, June 12, 2009 at at Friday, June 12, 2009 by Ben HI 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>
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.
XRM Taking Off
Posted On Wednesday, March 18, 2009 at at Wednesday, March 18, 2009 by Ben HAt 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.
Iterating Through a Collection Using Reflection
Posted On Tuesday, March 10, 2009 at at Tuesday, March 10, 2009 by Ben HI 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: }
Circular Reference Error in Silverlight
Posted On Friday, March 06, 2009 at at Friday, March 06, 2009 by Ben HI’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”.
Make sure that the project you are referencing does not have a reference to the current project.
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.
Rocky Mountain Tech-Trifecta – Less than one week away
Posted On Sunday, February 15, 2009 at at Sunday, February 15, 2009 by Ben HFor those of you in the Rocky Mountain area we are one week away from the Tech-Trifecta in Denver. In case you live in a cave, the Tech-Trifecta is a free event including three tracks: .NET Development, SQL Server and Windows. If you have not registered please do at www.rmtechtrifecta.com. In case you didn’t know the speaker and topic schedule has also been updated. We have some unbelievable stuff going on. I can’t believe this is a free event! Please join us. I will be speaking there as well and I hope to see you. If you can’t make one of my sessions, please stop me in the hall or atrium and say Hello.
Also, I am organizing a Skiing\Boarding day at Copper Mountain on next Sunday the day after the event. Anyone is welcome but please register for that event as well so we know how many discounted tickets we will need. The link to register for the Skiing\Boarding event is also on the Trifecta site. I am looking forward to the Trifecta, but I’m also looking forward to blowing of some steam the day after.
Silverlight is the Future?
Posted On Friday, February 06, 2009 at at Friday, February 06, 2009 by Ben HJust wanted to pass on this link to a post from Rocky Lhotka. He describes why many of his new projects are starting to favor Silverlight over ASP.NET and Win Forms. It’s a quick read and gets you thinking. Check it out:
More Windows 7 Info
Posted On Friday, January 30, 2009 at at Friday, January 30, 2009 by Ben HI came across this Windows 7 informational site yesterday on Gizmodo. They have some great tips and tricks and also walk you through the installation process. I’m sure there are more sites out there related to Windows 7. Anyone have any others I should check out?
.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.
Windows 7 Beta Stability is Solid!
Posted On at at Wednesday, January 28, 2009 by Ben HI took the plunge last weekend and loaded the latest Windows 7 Beta on my laptop. I decided to just go for it. I had already loaded it on a spare laptop from work, but until you use something on a day to day basis you don’t really get a good feel for it. Overall the experience has exceeded my expectations. Here is a list of things I like:
- The most impressive thing was the easy of installation and driver support. I have an AMD Turion 64 X2 laptop. The laptop was loaded with Vista 32 bit. I decided to go all in and load the 64 bit version of the Beta. Install was clean and the first time I logged in my screen resolution was really low. However, after the first login Windows Update ran automatically. Once that was done and I restarted the machine and was happy to find that my video and audio where back to normal. I’ve been running for 5 – 6 days now smoothly and without a crash.
- Another thing I have been happy with is the power management. I have three kids under the age of 6. So, I like to move around with my laptop while I keep one eye on them. The power on my laptop seems to last longer without sacrificing connectivity or performance.
- Next, The new task bar is really useful. Instead of having multiple entries in the task bar for every window, Windows 7 groups them by application. This is big. For example when I’m using Outlook I frequently have multiple messages along with calendar entries, contacts etc open at once. Windows 7 shows one icon on the task bar.
- Then when I hover on that icon it expands and shows all the windows opened related to Outlook.
- Very Cool!
A couple things I don’t like so far.
- Support for multiple monitors is a bit difficult. Maybe I just need some time to get used to it, but it took some extra clicks to get my second monitor configured. I also had to save my settings multiple times to get it to work. Not a big deal, but kind of annoying.
- I also was disappointed that there is not support for mounting ISO files built into the OS. Also MagicDisk, which is the one I used on Vista, did not work. I found tons of blogs on this and finally loaded PowerISO. PowerISO worked fine, but the fact that this took so long bothered me.
I will post any other things as I come across them, so far I’m running without a hitch. The bottom line is that if you are thinking about trying it I would recommend it. It is beta software so buyer beware, but so far this buyer is very satisfied.
Silverlight Path Resolution
Posted On Thursday, December 11, 2008 at at Thursday, December 11, 2008 by Ben HFirst let me explain path resolution. I have an image I want to use as my XAML button. Easy enough I add an Image control to my Control Template for the button and set the source to the path of that image. Path resolution is how the compiler determines where that image is. I could hard code it to a directory on my hard drive, but that is never good because that path could change between environments or client machines. So, most times we use relative paths. Combinations of ".." and slashes help us navigate the application structure to find the files.
Path resolution in XAML can be hard to understand. It get's even more complicated once you add Silverlight to the mix. Then on top of that when you are using User Controls from a Silverlight User Control Library things get down right nasty! Then add in some shared Control Templates and things get darn near impossible. That is the scenario I'm in. I ran across this article which helped me get it working. Check it out.
One important thing to note is how you must mark the properties on the images. Depending on how you are going to access the files you have to either set the Build Action property as "Content" or "Resource". You might also need to set the Copy To Output Directory property to "Copy Always".
Another thing to note in my case is that if the Control Template is a shared\application level template, the images must reside in the application project, not the control library. The path used in the shared Control Template is related to the application not the control library.
The most important thing is to pick a one way and stick to that throughout the application.
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!