I'm trying to convert/project a collection to a datatable data structure like this:
Dim coll As New CollectionClasses.ActionsCollection
coll.GetMulti(selectFilter)
Dim v As New EntityView(Of ActionsEntity)(coll)
Dim dt As New Data.DataTable()
v.CreateProjection(EntityFields2.ConvertToProjectors(FactoryClasses.EntityFieldsFactory.CreateEntityFieldsObject(EntityType.ExportActionsEntity)), dt)
...however, I getting the following error:
Unable to cast object of type 'SD.LLBLGen.Pro.ORMSupportClasses.EntityFields' to type 'SD.LLBLGen.Pro.ORMSupportClasses.IEntityFields2'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Unable to cast object of type 'SD.LLBLGen.Pro.ORMSupportClasses.EntityFields' to type 'SD.LLBLGen.Pro.ORMSupportClasses.IEntityFields2'.
Source Error:
Line 105: Dim v As New EntityView(Of ExportActionsEntity)(coll)
Line 106: Dim returnValue2 As New Data.DataTable()
Line 107: v.CreateProjection(EntityFields2.ConvertToProjectors(FactoryClasses.EntityFieldsFactory.CreateEntityFieldsObject(EntityType.ExportActionsEntity)), returnValue2)
Line 108:
Line 109: Return returnValue2
Source File: C:\Visual Studio 2008\Projects\P1\App_Code\ActionHelper.vb Line: 107
Stack Trace:
[InvalidCastException: Unable to cast object of type 'SD.LLBLGen.Pro.ORMSupportClasses.EntityFields' to type 'SD.LLBLGen.Pro.ORMSupportClasses.IEntityFields2'.]
ActionHelper.GetActionsAsDataTable(Int32 customerId, ActionSource actionSource, Int32 locationGroupId, ActionStatus actionStatus, Int32 countryId) in C:\Visual Studio 2008\Projects\P1\App_Code\ActionHelper.vb:107
Common_UcActions.ExportActions_Click(Object sender, EventArgs e) in C:\Visual Studio 2008\Projects\P1\Common\UcActions.ascx.vb:298
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927
What am I doing wrong?