开发者

Cannot be used as type parameter 'TElement' in the generic type or method

I am using Entity Model, C#, .NET Framework 3.5. I have generated entity classes from POCO, but it had issues on ObjectSet and CreateObjectSet which I fixed by replac开发者_运维知识库ing them with ObjectQuery and CreateQuery.

But I still have one issue in following code in EntityGenerator.Context.cs,

The code is

public ObjectResult<lead> GetLeads()
        {
            **return base.ExecuteFunction<lead>("GetLeads");**
        }

And the error is

Proj.EntityModel.employee cannot be used as type parameter 'TElement' in the generic type or method 'System.Data.Objects.ObjectContext.ExecuteFunction(string, params System.Data.Objects.ObjectParameter[])'. There is no implicit reference conversion from 'Proj.EntityModel.employee' to 'System.Data.Objects.DataClasses.IEntityWithChangeTracker'.

What's this error? What's solution?


It sounds like you just need to make employee implement IEntityWithChangeTracker.

(I suspect you've cut and paste the wrong section of code though, given that the error talks about employee and your code talks about lead. I'd also encourage you to change your names so that they follow .NET naming conventions.)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜