WP7 Linq To SQL(SQL CE) IDataErrorInfo
为实体类实现 IDataErrorInfo
的最佳实践是什么。与表或视图关联的类。
我有一个视图,它绑定到任务实体类中的记录,并且需要在将数据保存到 SQL CE 数据库之前验证数据。需要知道在这种情况下实现 IDataErrorInfo 的最佳方法。我假设只是在任务实体类上执行此操作,但想确定一下。因为我有很多需要验证的实体类。
What is the best practice for implementing IDataErrorInfo
for an entity class. A class that is associated with a table or view.
I have a View that binds to a record from a Task entity class and need to validate the data before it is saved to the SQL CE database. Need to know the best way to implement IDataErrorInfo
in this case. I assume just do it on the Task entity class, but want to make sure. Since I have many entity classes that will need validation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用自动生成的实体吗?在这种情况下,通常的做法是在定义实体的同一项目中创建第二个文件并创建其第二部分:
接口在另一个部分部分中实现的原因是初始部分是由某些 API 自动生成的(Linq-to -sql、EF 等),并且该 API 可以在每次进行一些更改时重新生成代码。重新生成将删除您的更改,但如果您将它们放置到您自己的部分部分,则更改将不会被删除。
Are you using autogenerated entities? In such case the usual practice is creating second file in the same project where entity is defined and create its second partial part:
The reason why the interface is implemented in another partial part is that the initial part is autogenerated by some API (Linq-to-sql, EF, etc) and that API can regenerate the code each time you do some changes. That regeneration would delete your changes but if you place them to your own partial part changes will not be deleted.