开发者

how to make entity method available at client side?

开发者 https://www.devze.com 2023-01-19 21:46 出处:网络
EF + WCF Ria Service: Suppose I have 开发者_如何学Goentity People, because it is a partial class, so I can extend it to add a method to it:

EF + WCF Ria Service: Suppose I have 开发者_如何学Goentity People, because it is a partial class, so I can extend it to add a method to it:

partial class People{
  static string GetMyString(){
     //......
     return string;
  }
}

then at client side, I want to method GetMyString available for entity People. what's the best way to implement this?


In your server side project, you should have (but is not necessary) a People.cs class that contains your metadata, such as attributes for validation.

Also in your server project, create a public partial class named People.shared.cs. In this class you can add your methods such as the GetMyString() method. The People.shared.cs class gets code-generated (copied) to the client project.

0

精彩评论

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

关注公众号