信息:VS2010,DSL工具包,C#DSL自定义构造函数 - 只调用创建不加载时
我有它增加了一些子元素我的领域类的一个自定义构造函数。我有一个问题,我只希望这不是图打开每次(它调用construtors)运行时创建的域类元素时
public Entity(Partition partition, params PropertyAssignment[] propertyAssignments)
: base(partition, propertyAssignments)
{
if (SOMETHING_TO_STOP_IT_RUNNING_EACH_TIME)
{
using (Transaction tx = Store.TransactionManager.BeginTransaction("Add Property"))
{
Property property = new Property(partition);
property.Name = "Class";
property.Type = "System.String";
this.Properties.Add(property);
this.Version = "1.0.0.0"; // TODO: Implement Correctly
tx.Commit();
}
}
}
谢谢保罗为你答复。我现在要做一些测试! – 2009-09-23 14:20:43
它的工作原理,非常感谢。在DSL中学习很多,但我发现它确实值得努力 – 2009-09-23 14:56:29
作为一个半边问题。如果我想在创建图的时候做一些类似的事情(Project> Add Item),那么我应该使用构造函数吗?还是应该使用与这里相同的模式?谢谢 – 2009-09-23 15:34:08