开发者

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

开发者 https://www.devze.com 2023-02-05 05:04 出处:网络
For example : <asp:EntityDataSource ID=\"EntityDataSource2\" runat=\"server\" ConnectionString=\"name=AdventureWorksEntities开发者_运维知识库\"

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


"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"
0

精彩评论

暂无评论...
验证码 换一张
取 消