Cannot compare elements of type 'System.Collections.Generic.List`1'. Only primitive types, enumeration types and entity types are supported.The solution to resolve this issue is, make sure don't have any null condition checks in the where clause.
Monday, 1 April 2013
Cannot compare elements of type 'System.Collections.Generic.List
Sunday, 24 March 2013
Get Bin Directory Path using C# for web application as well as class library
string binPath = Path.GetDirectoryName((new System.Uri(Assembly.GetExecutingAssembly().CodeBase)).LocalPath)
Friday, 15 March 2013
Application pool always getting stopped
After research for this problem on google and gone through the EventViewer and found that this is the problem with the user credentials for the applicationpool running under the specified user. Password for my user got expired.
Solution: Make sure password for the user is correct and it is not expired. If it is expired please update with new password.
Monday, 24 December 2012
Xml Serialization Behavior
Data Type |
Property Behavior |
Tag removed |
i:nil="true" |
Empty Tag |
Invalid Content |
Comments |
Int, decimal |
Nullable |
Null |
Null |
Exception |
Exception |
|
Not Nullable |
0 |
Exception |
Exception |
Exception |
||
DateTime |
Nullable |
Null |
Null |
Exception |
Exception |
DateTime should be the following format, otherwise throws an exception |
Not Nullable |
0001-01-01T00:00:00 |
Exception |
Exception |
Exception |
||
Collections |
-NA- |
Initialized new object with collection count as zero |
Initialized new object with collection count as zero |
Initialized new object with collection count as zero |
Initialized new object with collection count as zero |
Decorate property with [XmlElement(IsNullable=true)] attribute to set the property as null instead of initializing new object |
Csharp Object |
-NA- |
Null |
Initialized to New Object |
Initialized to New Object |
Initialized to New Object |
Decorate property with [XmlElement(IsNullable=true)] attribute to set the property as null instead of initializing new object |
Enum |
Nullable |
Null |
Null |
Exception |
Exception |
|
Not Nullable |
Initialized with firt enum element |
Exception |
Exception |
Exception |
Sunday, 30 September 2012
'Microsoft' is undefined
0x800a1391 - JavaScript runtime error: 'Microsoft' is undefined windows azure mobile servicesI searched the google to find the solution for this problem, but I did not found any solution. I tried many ways of referring script files. Finally I got the solution. The mistake what I did was only referring MobileSerivces.js in the groupedItems.html page where I am using grid layout in my metro application.
Solution:
Refer MobileServices.js in the default.html page as well.
Tuesday, 10 July 2012
Could not load type 'System.Web.Http.Dependencies.IDependencyScope'
Asp.net MVC4 Beta for the WebApi project. Everything is working for me fine. Suddenly one day I got the latest version of code from TFS and try to run the application. The solution build succeed, but the application throwing the following exception.
Could not load type 'System.Web.Http.Dependencies.IDependencyScope' from assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'The same application is running in my other teammates. I researched around one day, but did not found any solution that why this dll is not loading run time even though the dll is present in the bin folder. One of my team mate told that Asp.Net MVC4 is updated from beta to release version. I updated that in my system then the application is working fine. There was mismatch in the team communicatin about this updatation I lost my one day. If any one get this exception try to update the WebApi to release candidate.
Tuesday, 5 June 2012
Date Comparision in Entity Framework
context.GetQuery<TaxLocExtract>().Where( tle => tle.EffectiveDate.Date == effectiveDate.Date).ToList();then we will get the following exception
The specified type member 'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.the solution to resolve is System.Data.Objects.EntityFunctions.TruncateTime() is used. the sample query as follows.
context.GetQuery<TaxLocExtract>().Where( tle => System.Data.Objects.EntityFunctions.TruncateTime(tle.EffectiveDate) == System.Data.Objects.EntityFunctions.TruncateTime(effectiveDate)).ToList();I hope this solution helps.