Вопрос

I have a custom Ocean workstep in Petrel, but I cannot succeed in persisting my arguments package. My package contains PillarGrid objects (Gird, Property, Zone) as shown below :

[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);
    }

}

I created a DataSourceFactory based on a StructuredArchiveDataSource :

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

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

I registered this DataSourceFactory in he module method "integrate".

When I try to save my project in Petrel, I have the following error message : "System.Exception: MyArgsPackId: Not an archivable type 'Slb.Ocean.Petrel.DomainObject.PillarGrid.Property'"

How can I manage this persistence please ?

Это было полезно?

Решение

PillarGrid and other complex types cannot be persisted in this manner.

For IIdentifiable objects you should persist their DROID.

Later you can then retrieve the object from said DROID using DataManager.Resolve.

Chippy

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top