Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is "it" in EntityDataSource's select property?

For example :

<asp:EntityDataSource ID="EntityDataSource2" runat="server" 
            ConnectionString="name=AdventureWorksEntities" 
            DefaultContainerName="AdventureWorksEntities"  
            EnableUpdate="True" EntitySetName="Employee" 
            Select="" Where="it.EmployeeID = @selEmpID">
            <WhereParameters>
            <asp:ControlParameter ControlID="GridView1" Name="selEmpID" Type="Int32" PropertyName="SelectedValue" />
            </WhereParameters>
</asp:EntityDataSource> 

Is the "it" generate by EntityDataSource? The "it" is the entity alias of Employee, but how can i define that?

For exmaple, if i include other entity by property below :

Include="Users,Permissions"

How to define different alias to different entity e.g.:

emp = Employee usr = Users perm = Permissions

like image 957
Cheung Avatar asked Oct 13 '22 17:10

Cheung


1 Answers

"it" is the "Control Variable." You can change it using ObjectQuery's Name property.

ObjectQuery is what you get, for example out of your ObjectContext class, such as context.Products or context.Customers.

var query = context.Products;
query.Name = "products";  // changes "it" to "products"
like image 121
anon Avatar answered Oct 18 '22 08:10

anon