Show / Hide Table of Contents

Class CollectionToDictionaryDataMigration

Inheritance
System.Object
CollectionMigration
CollectionToDictionaryDataMigration
Implements
IMigration
Inherited Members
CollectionMigration.itemSchemaType
CollectionMigration.newSchemaType
CollectionMigration.itemSerializer
CollectionMigration.migrationManager
Namespace: Eco.Core.Serialization.Migrations.CollectionMigrations
Assembly: Eco.Core.dll
Syntax
public class CollectionToDictionaryDataMigration : CollectionMigration, IMigration

Constructors

CollectionToDictionaryDataMigration(String, String)

Declaration
public CollectionToDictionaryDataMigration(string itemSchemaType, string newSchemaType)
Parameters
Type Name Description
System.String itemSchemaType
System.String newSchemaType

Properties

ItemInput

Declaration
public DataInput ItemInput { get; }
Property Value
Type Description
DataInput

Methods

AddKeyOutputGenerator(Func<IDictionary<IDataInput, ReaderDataInput>, ReaderDataInput>)

Adds key output generator modification. keyGenerator generates ReaderDataInput for an entry key. DataInputs provided as second argument and may be used for accessing other registered data inputs. Migration from list of CurrencyHolding to Dictionary with Currency.SerializedId as a key.

var dm = new DataMigration(typeof(BankAccount));
var holdingsMigration = new CollectionToDictionaryDataMigration(SchemaUtils.GetSchemaType(typeof(CurrencyHolding)));
var serializedId      = holdingsMigration.ItemInput.Member("Currency").Member("SerializedID");
holdingsMigration.AddKeyOutputGenerator(inputs => inputs[serializedId]);
dm.MigrateMember(nameof(BankAccount.CurrencyHoldings), holdingsMigration);
Declaration
public void AddKeyOutputGenerator(Func<IDictionary<IDataInput, ReaderDataInput>, ReaderDataInput> keyGenerator)
Parameters
Type Name Description
System.Func<System.Collections.Generic.IDictionary<IDataInput, ReaderDataInput>, ReaderDataInput> keyGenerator

AddKeyOutputGenerator<TOutput>(Func<IDictionary<IDataInput, ReaderDataInput>, TOutput>)

Same as AddKeyOutputGenerator(Func<IDictionary<IDataInput, ReaderDataInput>, ReaderDataInput>), but generates a value instead of ReaderDataInput.

Declaration
public void AddKeyOutputGenerator<TOutput>(Func<IDictionary<IDataInput, ReaderDataInput>, TOutput> keyGenerator)
Parameters
Type Name Description
System.Func<System.Collections.Generic.IDictionary<IDataInput, ReaderDataInput>, TOutput> keyGenerator
Type Parameters
Name Description
TOutput

Initialize(MigrationManager)

Declaration
public override void Initialize(MigrationManager manager)
Parameters
Type Name Description
MigrationManager manager
Overrides
CollectionMigration.Initialize(MigrationManager)

Migrate(MigrationContext)

Declaration
public override void Migrate(MigrationContext context)
Parameters
Type Name Description
MigrationContext context
Overrides
CollectionMigration.Migrate(MigrationContext)

MigrateEntries(Int32, MigrationContext, BinaryWriter)

Migrates Collection to Dictionary entries. Number of entries provided as count. Migrated content written to writer.

Declaration
protected int MigrateEntries(int count, MigrationContext context, BinaryWriter writer)
Parameters
Type Name Description
System.Int32 count
MigrationContext context
System.IO.BinaryWriter writer
Returns
Type Description
System.Int32

Implements

IMigration

Extension Methods

PropertyChanges.FirePropertyChanged(Object, String)
PropertyChanges.FirePropertyChanged(Object, String, Object, Object)
PropertyChanges.FirePropertyChanged(Object, MemberChangedBeforeAfterEventArgs)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾