Issue with Kigg and EntityFramework

Feb 16, 2010 at 2:19 PM

Hi,
First, thanks for releasing Kigg as open source, this really help me to learn best practices in MVC stream.

I have been trying to resolve a technical issue with EntityFramework block used in Kigg. I removed all references of Ling2Sql, and copied respected .config files from ConfigurationFiles folder. I also able to compile the complete solution properly but face issue when code EntityFramework (Kigg.Infrastructure.EF) block. Like, when I search for a content in installed Kigg, I get this error:

The specified type member 'ApprovedAt' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.

Code: EntityFramework\Repository\StoryRepository.cs
Line: 324

.Count(s => (s.ApprovedAt != null) && (Database.StorySearchResult.Any(r => r == s.Id) || s.Category.Name.Contains(query) || s.StoryTagsInternal.Any(t => t.Name.Contains(query))));


I googled this issue and look like this is another limitation with EF. I also search this discussion forum and I didn't find any topic relating to this. So probably I am doing something wrong.

I appreciate if someone help me and give some pointer.

Thanks

Feb 16, 2010 at 2:28 PM

Please note that Kigg is working perfectly with Linq2Sql block.

Coordinator
Mar 27, 2010 at 12:22 AM

Sorry I know this is a very late response!

I explored the source code and tested KiGG locally using Entity Framework and I couldn't reproduce your issue! Beside ApprovedAt is defined in EDM, it is not a custom property that we made in code!

Here is a snippet of the EDM generated code!!

[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
[global::System.Runtime.Serialization.DataMemberAttribute()]
public global::System.Nullable<global::System.DateTime> ApprovedAt
{
     get
     {
         return this._ApprovedAt;
     }
     set
     {
         this.OnApprovedAtChanging(value);
         this.ReportPropertyChanging("ApprovedAt");
         this._ApprovedAt = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
         this.ReportPropertyChanged("ApprovedAt");
         this.OnApprovedAtChanged();
     }
}
private global::System.Nullable<global::System.DateTime> _ApprovedAt;