[英]Entity Framework Core 6 : properties virtual vs non virtual
Let's say I have a POCO class with only 2 properties;假设我有一个只有 2 个属性的 POCO 类; one is virtual, the other is not.一个是虚拟的,另一个不是。
public class MyPocoClass
{
public string SomeProperty { get; set }
public virtual string SomePropertyTwo { get; set }
}
Does the virtual property ( SomePropertyTwo
) have any side effect?虚拟财产( SomePropertyTwo
)是否有任何副作用? Does it reduce performance etc?它会降低性能等吗?
as far as i know virtual property only used when you want to use lazy loading据我所知,虚拟属性仅在您想使用延迟加载时使用
In this context, "virtual" keyword is only redundant keyword and should be removed.在这种情况下,“virtual”关键字只是多余的关键字,应该删除。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.