如何在Ocean for Petrel中归档我的arg包?

时间:2013-05-24 07:24:16

标签: persistence ocean petrel

我在Petrel有一个自定义海洋工作步骤,但我无法成功坚持我的论点包。我的包中包含PillarGrid对象(Gird,Property,Zone),如下所示:

[Archivable(Version = 1, Release = "2013.6")]
public class MyArguments : DescribedArgumentsByReflection, IIdentifiable
{
    [Archived]
    private Grid grid = Grid.NullObject;

    [Archived]
    private int seedNumber;

    [Archived]
    private int numberRealizations = 1;

    [Archived]
    private Zone regionZone = Zone.NullObject;

    [Archived]
    private Property property = Property.NullObject;

    [Archived]
    private Droid droid = Droid.Empty;

    ...

    public DeeSseArguments()
        : base()
    {
        // adding this to datasource
        IDataSourceManager dsManager = DataManager.DataSourceManager;
        string DataSourceId = DeeSseDataSourceFactory.DataSourceId;
        StructuredArchiveDataSource dataSource = dsManager.GetSource(DataSourceId) as StructuredArchiveDataSource;
        this.droid = dataSource.GenerateDroid();
        dataSource.AddItem(this.droid, this);
    }

}

我基于StructuredArchiveDataSource创建了一个DataSourceFactory:

public class MyDataSourceFactory : DataSourceFactory
{
    public static string DataSourceId = "MyArgsPackId";

    public override Slb.Ocean.Core.IDataSource GetDataSource()
    {
        return new StructuredArchiveDataSource(DataSourceId, new[] { typeof(MyArguments) });
    }
}

我在模块方法“integration”中注册了这个DataSourceFactory。

当我尝试在Petrel中保存项目时,出现以下错误消息:“System.Exception:MyArgsPackId:Not a archivable type'Slb.Ocean.Petrel.DomainObject.PillarGrid.Property'”

我该如何管理这种持久性呢?

1 个答案:

答案 0 :(得分:1)

PillarGrid和其他复杂类型不能以这种方式持久存在。

对于IIdentifiable对象,你应该坚持他们的DROID。

稍后您可以使用DataManager.Resolve从所述DROID中检索对象。

副井