In VS 2010, extension manager is part of a nice new generation of VS plug-in system. One of the great features of it is how it can go online talk to Microsoft Visual Studio Gallery website to retrieve list of extensions there, automatically discovering updates for installed extensions, and allowing me to add new extensions directly from within Visual Studio.
The Problem:
However, in my company I could not take benefit of that for long time. Reason is, the company uses Blue Coat proxy, with some active directory based authentication. We cannot access the Internet unless we use that proxy, no direct connection allowed, most other proxies are also blocked (by blocking the common proxies port 8080 and many other common ports).
Although I have the proxy set in Internet Explorer, and I have the username/password stored in my Windows Credentials store (Start–> Run–> Control Panel\All Control Panel Items\Credential Manager) -since my primary work laptop and user account on it are not part of the company domain-, Visual Studio did not seem to be able to use that.
Anything that requires online communication not directly using the browser is not working. The main feature missed by this is Extensions Manager integration with the Visual Studio Gallery online.
Read the full post ... (608 words, 4 images, estimated 2:26 mins reading time)
.NET, .NET FAQ, Code Gallery, FAQ, Microsoft, Office Productivity, Visual Studio, Visual Studio 2010, Visual Studio Add-ins
In NHibernate there is a Save(entityObject) method, which creates a new row in the database with the given entity object, also, has an Update(entityObject) which updates the row corresponding to the entity object with the property values of this object. It also has a SaveOrUpdate(entityObject) method, which checks the whether the entity object corresponds to an existing row in the database, and chooses whether to call Save(…) or Update(…) based on that.
The way I usually do web applications across multiple tiers, when not using view models specifically, makes me encapsulate much code in Services layer that sometimes does not need to care about whether the given entity is persisted in database or not. Thus wanted to have similar method using Entity Framework as ORM.
Of course I have implemented the method number of times and the code evolved based on which version of Entity Framework I’m coding against, and my knowledge of the framework internals as well. Actually, when you work with so many ORMs like I did, a new ORM or ORM version turns to only sound like “What’s new in the manual?” thing.
Read the full post ... (821 words, estimated 3:17 mins reading time)
.NET, .NET FAQ, ADO.NET, C#, Code Snippets, Entity Framework, NHibernate
.
Microsoft has released a final version of its book “Microsoft Application Architecture Guide, 2nd Edition”.
The book is described as:
This guide is available online here in the MSDN Library and will be available in the Fall of 2009 as a Microsoft Press book, ISBN# 9780735627109, that you can purchase through local and online booksellers.
The guide is intended to help developers and solution architects design and build effective, high quality applications using the Microsoft platform and the .NET Framework more quickly and with less risk; it provides guidance for using architecture principles, design principles, and patterns that are tried and trusted. The guidance is presented in sections that correspond to major architecture and design focus points. It is designed to be used as a reference resource or to be read from beginning to end.
The guide helps you to:
- Understand the underlying architecture and design principles and patterns for developing successful solutions on the Microsoft platform and the .NET Framework.
- Identify appropriate strategies and design patterns that will help you design your solution’s layers, components, and services.
- Identify and address the key engineering decision points for your solution.
Read the full post ... (281 words, 1 image, estimated 1:07 mins reading time)
.NET, .NET FAQ, Architecture, Domain Driven Design, Ebooks, FAQ, General News, Link List, Microsoft News, Miscellaneous, OOP, Patterns, Visual Studio
While I was planning to write about the same topic and have the draft ready in my Windows Live Writer waiting to complete, I found an interesting question in StackOVerflow and couldn’t just resist to answer:
The question starts with:
I’m starting a new project and I’m looking around for either a very good ORM or for a non-SQL-based persistence layer.
Then follows up with a REALLY GOOD summary of what he believes about each known ORM he knew out of his own findings and search. I advice you to go read it.
However, all this investigation didn’t get him to a single choice answer. And I can’t blame him. This is one fo the questions that will remain for so long without a single answer, or maybe having the popular “It depends” answer.
I have had a LONG research in this topic as well. I have read for so long (and watched videos/casts) to make sure of the best usage of many ORMs and then used them sometimes in test projects sometimes in production, and I wanted to share my thoughts based on this. I posted a long answer there on the question in StackOverflow, and I want to share this answer with you here. I may also have a second part of this post based on my existing Windows Live Writer draft, but, based on my previous times, I think I won’t!
Read the full post ... (1188 words, 1 image, estimated 4:45 mins reading time)
.NET, .NET FAQ, ALT.NET, Domain Driven Design, Entity Framework, FAQ, LINQ, LINQ To SQL, LLBLGen, NHibernate, ORM
Few minutes ago a colleague and friend asked me about some problem he was having with ASP.NET themes. He was using a theme and including a CSS file in it, the CSS file was linked in the generated HTML but clearly it was not applied. Putting the URL of the CSS file in the browser address bar would return an empty result in Firefox, and a crappy DOCTYPE,HTML,HEAD,BODY tags in IE. The same website works normally with other developers running Windows XP or Windows 7.
Going further to the problem, I tried checking the file access, giving extra permissions and so on, checking web.config and global.asax for any ASP.NET HTTP Handler or HTTP Module that might be handling all requests. None of this existed. Then, I switched to IIS, trying to change the website from custom Application Pool to default integrated pipeline one to default classic (IIS 6 like) one, but no use.
Now I started thinking, images in the website didn’t show also! I didn’t know whether this was a DB/code issue or related to not showing the CSS, well, maybe something is wrong with IIS installation, right? Well, exactly!!!
Here’s what the problem was:

Read the full post ... (248 words, 1 image, estimated 60 secs reading time)
.NET, .NET FAQ, ASP.NET, Web Design
This was originally an email I sent to .NET team in my company, then decided to share as a blog post.
The problem:
- Let’s say you have a complex application, and this application (or part of it) runs very slowly. No bug s in results, no errors or exceptions, but it just so slow! Now you want to know which part of your code is the reason, which method(s) you need to go and modify., which methods take so long to execute or consume so much memory/CPU. How would you know that?
- Let’s say you want to improve the performance of your application in general (say add caching or such), so, you want to identify which parts of your code deserve your attention and will really make difference (so that you don’t waste your time on optimizing something that will not have big effect in performance), for example, you might want to identify which methods are called more than others from different parts of your code. How would you do that?
Read the full post ... (822 words, 19 images, estimated 3:17 mins reading time)
.NET, .NET FAQ, ALT.NET, Architecture, ASP.NET, ASP.NET 2.0, Link List, Miscellaneous, Visual Studio
Allow me to quote here some emails I sent to the the Dot NET developers group in my company, Injazat, or, as we call ourselves, Ninjazat. I thought it’ll be useful to share some with you as well.
· ASP.NET MVC – 20 Hours of FREE Video Tutorials
· LINQ FAQ
o LINQ FAQ for Newbie’s
o LINQ FAQ Part 2
· How we handle application configuration
· ScottGu ASPNETMVC Session Video Available Now (Part 1/2 & 2/2)
· Web Validation: Best Practices and Tutorials
· Building a Single Sign On Provider Using ASPNET and WCF
o Part 1
o Part 2
o Part 3
· NxtGenUG Cambridge: Creating extendable applications using MEF slides and code
· Dynamic Languages and .NET – Developer Day Scotland slides and code samples
· patterns & practices: Data Access Guidance (VS 2010 Stuff)
· Refactoring challenge
o Part 1 – Examination
o Part 2 – Preparation
· LINQ is not LINQ To SQL
Read the full post ... (300 words, estimated 1:12 mins reading time)
.NET, .NET FAQ, ASP.NET, ASP.NET MVC, DLR, Link List, LINQ, MEF, Miscellaneous, MVC, WCF, Web Design
Check the add-ins you installed before Visual Studio 2010 if you enabled VS 2010 integration in them. Particularly TestDriven.NET is the problem. Go to “Add Remove Programs” / “Programs and Features”, find Test Driven.NET, click “Change”, and then modify it to remove VS2010 integration from it.
Also, if you are using AnkhSVN, make sure to download a new latest daily update build and use that, otherwise, you’ll get an exception when starting VS 2010.
I’ll be writing more about VSTS 2010 and .NET 4.0 in the next coming months (if God will), since now I can run it :D (before, I did not have the fix that extends the Virtual Machine expiration after January 1st, 2009).
BTW, for R# deep lovers (like me), Resharper for VS 2010 is expected next month.
Have fun, please!
Technorati Tags:
VS,
Visual Studio,
VisualStudio,
VS2010,
VS10,
VS 2010,
Visual Studio 2010,
VisualStudio2010,
VisualStudio 2010,
TestDriven.NET,
TDD,
AnkhSVN,
Ankh SVN,
Resharper,
R#
Permanent link to this post (149 words, estimated 36 secs reading time)
.NET FAQ, Resharper (R#), Visual Studio
If you don’t know what eager loading is, Jump to “What’s eager loading?”.
Eager Loading Syntax
If you are eager loading Products for example in a typical (Categories 1<->* Products) relation, the standard syntax would like:
DbDataContext.Categories.Include(“Products”)
What is the problem with that?
The “Products” part. The word “Products” is a string. If I rename the Products table to ShopProducts or whatever or even remove it from this data diagram and have it elsewhere, or even something wrong happens and the relation is removed from DB/diagram by mistake, my code will still compile, but will fail when it runs. This is BAD BAD BAD.
How to solve this?
Since I always believe that if something exists somewhere you shouldn’t do it yourself unless its totally broken (and I mean REALLY REALLY BROKEN), I started searching inside the Entity Framework itself for something to get the entity name from.
At first it seemed super easy. Every entity class has a static property “EntityKeyPropertyName”, so, I thought I can write something like:
DbDataContext.Categories.Include(Product.EntityKeyPropertyName); // But this didn’t work
Read the full post ... (375 words, 1 image, estimated 1:30 mins reading time)
.NET, .NET FAQ, ADO.NET, C#, CodeProject, LINQ
Although I hate to quote that often, but, this one is totally worth it:
Brad Abrams recently wrote a reference to this great "Evolving a .NET 3.5 Application" white paper, about the common scenario of migrating a .NEt 2.0 project to .NET 3.5.
The white paper is available in PDF format here (direct link).
About which I quote Brad’s words:
I reader recently forwarded me an interesting case study that covers a very common scenario: Porting a .NET Framework 2.0 based application to .NET Framework 3.5.
The paper does a nice job of providing resources to get started with, how to learn what is new in .NET 3.5, etc. As well as details on why this project made decisions it did around using WPF, WCF, etc.
I don’t claim to agree with all the assertions made here, but all in all it is a very balanced, pragmatic view of what some of the common choices you will have.
The project uses client and server components and the paper talks about not only the design process but how to build AND test these. They talk about ViewModel in WPF, IoC, NUnit and VSTS, etc
Read the full post ... (204 words, estimated 49 secs reading time)
.NET, .NET FAQ, Link List, Miscellaneous