Friday, December 06, 2013

Chronicles on Migration From Entity Framework to Telerik OpenAccess - 1


I have to replace all the EntityDataSources to OpenAccessLinqDataSource's(or the old OpenAccessDataSource)
So this below:
<asp:EntityDataSource runat="server" ID="edsDegree" ConnectionString="name=Entities"  
DefaultContainerName="Entities" EnableFlattening="False"
    EntitySetName="Degrees" Include="College,DegreeType,MajorType"
    EntityTypeFilter="Degree" Where="it.UserID=@UserID">
    <WhereParameters>
        <asp:Parameter Name="UserID" DbType="Int32" />
    </WhereParameters>
</asp:EntityDataSource> 
will become :
<telerik:OpenAccessLinqDataSource runat="server" ID="edsDegree"
    ResourceSetName="Degrees" EntityTypeName="" 
ContextTypeName="DataModel.data"
  Select=" new (PlannedGraduationDate,GraduationDate, College,DegreeType,MajorType)"
    Where="it.UserID=@UserID">
    <WhereParameters>
        <asp:Parameter Name="UserID" DbType="Int32" />
    </WhereParameters>
</telerik:OpenAccessLinqDataSource>
 
 
Neither of the telerik data controls have the "Include" property. So if the EntityDataSource is using it ,
you can Include your related entities as Select="new (ID,Name, ChildEntity )".In the above examples related entities of Degree entity are:
College,DegreeType,MajorType

No comments:

Post a Comment