开发者

Changing readonly properties on an object

I have the following scenario: Modify function takes an input object, and calls the stored procedure to update the database. The stor开发者_如何学Goed procedure changes some columns, namely updated date, and updated by, among others and returns them back in a form of the dataset. Now, I need to change these properties on the object. However, the updated by and updated date are read only and must remain that way. I am wondering if anybody has suggestions about this conundrum? I want to avoid using reflection to set read only properties. Are there any other ways? Clarification: The objects are defined in assembly A and its constructors are internal. We are in assembly B. Gotta love modularity...

Thanks.


You can always create a new object and set the properties on the new object. Pass the current object in as a ref to indicate (and allow) that the new object with the updated values will replace it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜