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