本文介绍了强制进行静态成员初始化.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试学习如何在F#中使用CSLA.我创建了一个基本的CSLA对象类,如下所示:
I'm trying to learn how to use CSLA with F#. I've created a basic CSLA object class as follows:
[<Serializable>]
type Months_ROC() =
inherit Csla.BusinessBase<Months_ROC>()
static member IdProperty = BusinessBase<Months_ROC>.RegisterProperty<int>(new PropertyInfo<int>("Id"))
member m.Id with get() = m.ReadProperty(Months_ROC.IdProperty)
and set(v) = m.LoadProperty(Months_ROC.IdProperty, v)
当我执行时,我收到一个错误,指示在实例化该类后,RegisterProperty无法运行.如何确保IdProperty已在施工中运行?我认为静态功能"可提供此功能,但我似乎无法确定 正确的语法.
When I execute, I receive an error indicating the RegisterProperty cannot be run after the class has been instantiated. How can I assure that the IdProperty has been run at construction? I think 'static do' provides this feature, but I can't seem to nail the correct syntax.
推荐答案
进一步的谷歌搜索很高兴.
Happy further googling.
这篇关于强制进行静态成员初始化.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!