gpt4 book ai didi

c# - 生成密封类

转载 作者:太空宇宙 更新时间:2023-11-03 20:28:31 24 4
gpt4 key购买 nike

使用 linq to sql 我想在数据上下文中生成一些密封类。显然这是不可能的。

当我尝试扩展一个生成的类时,让我们说 ApplicationUser 像这样的部分

sealed public partial class ApplicationUser
{ }

我得到编译错误(总结)

'SendPropertyChanging()' is a new virtual member in sealed class 'ApplicationUser'

'SendPropertyChanged(string)' is a new virtual member in sealed class 'ApplicationUser'

很明显,因为这些方法是作为protected virtual 生成的。

有没有办法让 linq to sql 生成选定的(不是所有的)类作为密封的?

最佳答案

您可以通过在设计器中编辑属性来生成密封类:

enter image description here

关于c# - 生成密封类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8942207/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com