public AggregateOid(IMetamodelManager metamodel, ILoggerFactory loggerFactory, string[] strings) { this.metamodel = metamodel ?? throw new InitialisationException($"{nameof(metamodel)} is null"); var helper = new StringDecoderHelper(metamodel, loggerFactory, loggerFactory.CreateLogger <StringDecoderHelper>(), strings); typeName = helper.GetNextString(); FieldName = helper.GetNextString(); if (helper.HasNext) { ParentOid = (IOid)helper.GetNextEncodedToStrings(); } }
public CollectionMemento(ILifecycleManager lifecycleManager, INakedObjectManager nakedObjectManager, IMetamodelManager metamodel, string[] strings) : this(lifecycleManager, nakedObjectManager, metamodel) { var helper = new StringDecoderHelper(metamodel, strings, true); // ReSharper disable once UnusedVariable string specName = helper.GetNextString(); string actionId = helper.GetNextString(); var targetOid = (IOid)helper.GetNextEncodedToStrings(); Target = RestoreObject(targetOid); Action = Target.GetActionLeafNode(actionId); var parameters = new List <INakedObjectAdapter>(); while (helper.HasNext) { var parmType = helper.GetNextEnum <ParameterType>(); switch (parmType) { case ParameterType.Value: object obj = helper.GetNextObject(); parameters.Add(nakedObjectManager.CreateAdapter(obj, null, null)); break; case ParameterType.Object: var oid = (IOid)helper.GetNextEncodedToStrings(); INakedObjectAdapter nakedObjectAdapter = RestoreObject(oid); parameters.Add(nakedObjectAdapter); break; case ParameterType.ValueCollection: Type vInstanceType; IList <object> vColl = helper.GetNextValueCollection(out vInstanceType); IList typedVColl = CollectionUtils.ToTypedIList(vColl, vInstanceType); parameters.Add(nakedObjectManager.CreateAdapter(typedVColl, null, null)); break; case ParameterType.ObjectCollection: Type oInstanceType; List <object> oColl = helper.GetNextObjectCollection(out oInstanceType).Cast <IOid>().Select(o => RestoreObject(o).Object).ToList(); IList typedOColl = CollectionUtils.ToTypedIList(oColl, oInstanceType); parameters.Add(nakedObjectManager.CreateAdapter(typedOColl, null, null)); break; default: throw new ArgumentException(Log.LogAndReturn($"Unexpected parameter type value: {parmType}")); } } Parameters = parameters.ToArray(); }
public AggregateOid(IMetamodelManager metamodel, string[] strings) { Assert.AssertNotNull(metamodel); this.metamodel = metamodel; var helper = new StringDecoderHelper(metamodel, strings); typeName = helper.GetNextString(); fieldName = helper.GetNextString(); if (helper.HasNext) { parentOid = (IOid)helper.GetNextEncodedToStrings(); } }
public ConcurrencyCheckVersion(IMetamodelManager metamodel, ILoggerFactory loggerFactory, string[] strings) { var helper = new StringDecoderHelper(metamodel, loggerFactory, loggerFactory.CreateLogger <StringDecoderHelper>(), strings); User = helper.GetNextString(); time = new DateTime(helper.GetNextLong()); version = helper.GetNextObject(); }
public ConcurrencyCheckVersion(IMetamodelManager metamodel, string[] strings) { Assert.AssertNotNull(metamodel); var helper = new StringDecoderHelper(metamodel, strings); user = helper.GetNextString(); time = new DateTime(helper.GetNextLong()); version = helper.GetNextObject(); }
public ViewModelOid(IMetamodelManager metamodel, ILoggerFactory loggerFactory, string[] strings) { this.metamodel = metamodel ?? throw new InitialisationException($"{nameof(metamodel)} is null"); var helper = new StringDecoderHelper(metamodel, loggerFactory, loggerFactory.CreateLogger <StringDecoderHelper>(), strings); TypeName = helper.GetNextString(); Keys = helper.HasNext ? helper.GetNextArray() : new[] { Guid.NewGuid().ToString() }; IsTransient = false; CacheState(); }
public ViewModelOid(IMetamodelManager metamodel, string[] strings) { Assert.AssertNotNull(metamodel); this.metamodel = metamodel; var helper = new StringDecoderHelper(metamodel, strings); TypeName = helper.GetNextString(); Keys = helper.HasNext ? helper.GetNextArray() : new[] { Guid.NewGuid().ToString() }; IsTransient = false; CacheState(); }
public EntityOid(IMetamodelManager metamodel, string[] strings) { Assert.AssertNotNull(metamodel); this.metamodel = metamodel; var helper = new StringDecoderHelper(metamodel, strings); TypeName = helper.GetNextString(); Key = helper.GetNextObjectArray(); IsTransient = helper.GetNextBool(); EntityKey = (EntityKey)helper.GetNextSerializable(); if (helper.HasNext) { bool hasPrevious = helper.GetNextBool(); if (hasPrevious) { previous = (EntityOid)helper.GetNextEncodedToStrings(); } } CacheState(); }