Tuesday, March 1, 2011
Easily Setup Fluent Nhibernate With Oracle
I did a post here on setting up Fluent NHibernate DataAccess with Oracle.
Monday, February 14, 2011
Assembly Binding Tag
If you face assembly version mismatch problem then you will get "Could not load file or assembly" exception. There could be two solutions
1. Recompile the source code
2. If you dont have source code you can add a simple assemblyBinding tag under configuration in your web.config/app.config
For example I am using NHibernate.Validator dll which depends on NHibernate and was build with older version of NHibernate "2.1.2.4000". But in my project I have newer NHibernate version "3.0.0.2001". So i am getting the below exception
Could not load file or assembly 'NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies
To resolve this issue all i have to do is to add the below assemblyBinding configuration
More can be find at
http://msdn.microsoft.com/en-us/library/2fc472t2%28VS.71%29.aspx
1. Recompile the source code
2. If you dont have source code you can add a simple assemblyBinding tag under configuration in your web.config/app.config
For example I am using NHibernate.Validator dll which depends on NHibernate and was build with older version of NHibernate "2.1.2.4000". But in my project I have newer NHibernate version "3.0.0.2001". So i am getting the below exception
Could not load file or assembly 'NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies
To resolve this issue all i have to do is to add the below assemblyBinding configuration
More can be find at
http://msdn.microsoft.com/en-us/library/2fc472t2%28VS.71%29.aspx
Thursday, June 17, 2010
ASP.NET Website reusability
I did a post here about how ASP.NET Developers can use the concept of re-usability to build reusable website constructs and then can use these constructs in many websites.The article shows how to define common layout, images and styles once and how to use them for all web sites using ASP.NET.
Friday, April 23, 2010
Linq: Search Query that takes advantage of ?? operator to ignore the optional criteria fields
In search we often need to deal with the situations where users leave search input fields empty. Suppose user want to search customers against Last Name and Birth Year. The code snippet below shows the C# Search query; it works even if user leaves Criteria fields empty. Thanks to new ?? Null Comparison Operator....if the value of Criteria Field is null then the value proceeding ?? is replaced with the actual value...
public List Search( Criteria criteria )
var customers= from c in dataContext.Cutomers
where
(criteria.LastName?? c.LastName) == c.LastName
&& ( criteria.Year ?? 1980 ) <= c.BirthYear
select c;
return c.ToList();
}
public List
var customers= from c in dataContext.Cutomers
where
(criteria.LastName?? c.LastName) == c.LastName
&& ( criteria.Year ?? 1980 ) <= c.BirthYear
select c;
return c.ToList();
}
Labels:
?? operator,
c#,
Linq,
search,
search query
Subscribe to:
Posts (Atom)