private void RaiseDeletionEntityLoaded(EntityIdentifier entityId, TEntity entity) { this.eventDispatcher.DeletionEntityLoaded( new DeletionEntityLoadedArgs( this.operationExecutive.CurrentOperation.TimeStamp, entityId, entity)); }
public DeletionEntityLoadedArgs( DateTimeOffset timeStamp, EntityIdentifier entityId, TEntity entity) : base(timeStamp, entityId) { this.entity = entity; }
private void RemoveMapping( IDictionary <EntityIdentifier, IMapping <TEntity> > mappings, TEntity entity) { EntityIdentifier sourceSystemEntityId = this.safeMetadataProvider.GetSourceSystemEntityId(entity); mappings.Remove(sourceSystemEntityId); }
public void Constructor_Sets_Int32_Identifier() { var identifier = new EntityIdentifier(-2125483448); identifier .Identifier .Should() .Be("-2125483448"); }
public void Constructor_Sets_UInt32_Identifier() { var identifier = new EntityIdentifier(4234927293U); identifier .Identifier .Should() .Be("4234927293"); }
public void Constructor_Sets_Int64_Identifier() { var identifier = new EntityIdentifier(-9222371036854555806L); identifier .Identifier .Should() .Be("-9222371036854555806"); }
public void Constructor_Sets_UInt64_Identifier() { var identifier = new EntityIdentifier(18446724073709451651UL); identifier .Identifier .Should() .Be("18446724073709451651"); }
public void GetHashCode_Returns_UpperCase_String_Representation_Hash_Code() { var identifier = new EntityIdentifier("AbCdEfG"); identifier .GetHashCode() .Should() .Be("ABCDEFG".GetHashCode()); }
public void Constructor_Sets_String_Identifier() { var identifier = new EntityIdentifier("This is a unique identifier!"); identifier .Identifier .Should() .Be("This is a unique identifier!"); }
public void Equal_Returns_True_If_Identifiers_Equal() { var identifierOne = new EntityIdentifier("Alpha"); var identifierTwo = new EntityIdentifier("ALPHa"); EntityIdentifier .Equal(identifierOne, identifierTwo) .Should() .BeTrue(); }
public void Constructor_Sets_Guid_Identifier() { var identifier = new EntityIdentifier( Guid.Parse("A572507A-3876-4794-B515-5DCC0A0CF694")); identifier .Identifier .Should() .Be("a572507a-3876-4794-b515-5dcc0a0cf694"); }
public void Equal_Returns_False_If_Identifiers_Differ() { var identifierOne = new EntityIdentifier("Bravo"); var identifierTwo = new EntityIdentifier("Charlie"); EntityIdentifier .Equal(identifierOne, identifierTwo) .Should() .BeFalse(); }
/// <summary> /// Initializes a new instance of the class. /// </summary> /// <param name="identifier"> /// A case-insensitive string representation of the identifier. /// </param> public EntityIdentifier(string identifier) { ArgumentValidator.EnsureArgumentNotNull(identifier, nameof(identifier)); if (identifier.Length > MaxLength) { throw new ArgumentException( string.Format(Resources.EntityIdentifierTooLong, MaxLength), nameof(identifier)); } this.identifier = identifier; }
public DeletionProcessedArgs( DateTimeOffset timeStamp, IEnumerable <ILogMessage> logMessages, Exception exception, EntityIdentifier entityId, EntityDeletionOutcome outcome) : base(timeStamp, logMessages, exception) { this.entityId = entityId; this.outcome = outcome; }
public void Equal_Returns_False_If_One_Identifier_Null() { EntityIdentifier .Equal(new EntityIdentifier(885), null) .Should() .BeFalse(); EntityIdentifier .Equal(null, new EntityIdentifier(Guid.NewGuid())) .Should() .BeFalse(); }
private void RaiseDeletionProcessed( EntityIdentifier entityId, EntityDeletionOutcome outcome, Exception exception) { this.eventDispatcher.DeletionProcessed( new DeletionProcessedArgs( this.operationExecutive.CurrentOperation.TimeStamp, this.operationExecutive.CurrentOperation.LogMessages, exception, entityId, outcome)); }
/// <summary> /// Gets the specified entity instance from the destination system. /// </summary> /// <param name="id">The ID of the requested entity instance.</param> /// <returns>The requested entity instance.</returns> public TEntity Get(EntityIdentifier id) { return(this.Execute( () => { TEntity entity = this.serviceProvider.Sink.Get(id); if (entity != null) { entity = this.Preprocess(entity); } return entity; })); }
public void Equals_Returns_False_If_Other_Object_Is_Different_Identifier() { var identifier = new EntityIdentifier("12345"); identifier .Equals(new EntityIdentifier("123456")) .Should() .BeFalse(); identifier .Equals(new EntityIdentifier("012345")) .Should() .BeFalse(); }
public void Equals_Returns_False_If_Other_Object_Different_Type() { var identifier = new EntityIdentifier("88"); identifier .Equals(int.MaxValue) .Should() .BeFalse(); identifier .Equals(new Exception()) .Should() .BeFalse(); }
public void Equals_Returns_True_If_Other_Object_Is_Same_Identifier() { var identifier = new EntityIdentifier("AbCdEf"); identifier .Equals(new EntityIdentifier("AbCdEf")) .Should() .BeTrue(); identifier .Equals(new EntityIdentifier("aBcDeF")) .Should() .BeTrue(); }
private EntityTransactionOutcome ProcessNewEntity() { this.DestinationSystemEntity = this.gateway.New(); this.ValueChanges = this.Merge(); EntityIdentifier destinationSystemEntityId = this.CreateDestinationSystemEntity(); this.Mapping = this.mappingRepository.CreateMapping( this.SourceSystemEntityId, destinationSystemEntityId, MappingOrigin.NewEntity, this.SourceSystemEntity); return(EntityTransactionOutcome.NewEntityCreated); }
private EntityIdentifier GetSourceSystemEntityId() { EntityIdentifier sourceSystemEntityId = this .safeMetadataProvider .GetSourceSystemEntityId(this.SourceSystemEntity); if (sourceSystemEntityId == null) { throw new InvalidOperationException( Resources.EntityHasNoSourceSystemEntityId); } return(sourceSystemEntityId); }
public void UpdateIdentityCorrelationId(EntityIdentifier sourceSystemEntityId) { EntityIdentifier currentSourceSystemEntityId = this.GetCorrelationIdUpdateSourceSystemEntityId(); if (currentSourceSystemEntityId != null && currentSourceSystemEntityId != sourceSystemEntityId) { throw new InvalidOperationException( Resources.CannotChangeCorrelationIdUpdateSourceSystemEntityId); } this.Data[CorrelationIdUpdateSourceSystemEntityIdDataKey] = sourceSystemEntityId; }
/// <summary> /// Determines whether two <see cref="EntityIdentifier" /> instances represent the /// same identifier. /// </summary> /// <param name="identifierOne"> /// The first <see cref="EntityIdentifier" /> instance to compare, or null. /// </param> /// <param name="identifierTwo"> /// The second <see cref="EntityIdentifier" /> instance to compare, or null. /// </param> /// <returns> /// True, if the two instances represent the same identifier (or they're both /// null); otherwise, false. /// </returns> public static bool Equal( EntityIdentifier identifierOne, EntityIdentifier identifierTwo) { bool equal = false; if ((object)identifierOne != null && (object)identifierTwo != null) { equal = identifierOne.Equals(identifierTwo); } else if ((object)identifierOne == null && (object)identifierTwo == null) { equal = true; } return(equal); }
private void PerformIdentityCorrelationIdUpdate() { EntityIdentifier correlationIdUpdateSourceSystemEntityId = this.GetCorrelationIdUpdateSourceSystemEntityId(); if (correlationIdUpdateSourceSystemEntityId != null) { this.parent .safeRepository .UpdateIdentityCorrelationId( new OperationIdIdentity( this.Id, this.parent.context.EntityType.Id, this.parent.context.SourceSystem.Id, correlationIdUpdateSourceSystemEntityId)); } }
/// <summary> /// Creates an <see cref="EntityIdentifier" /> instance by converting the specified /// <see cref="object" /> instance. /// </summary> /// <param name="value"></param> /// <returns> /// A <see cref="EntityIdentifier" /> instance created by converting the specified /// <see cref="object" /> instance. /// </returns> public EntityIdentifier FromValue(object value) { EntityIdentifier identifier = null; if (value != null) { Func <object, EntityIdentifier> valueConverter = this.GetFromValueConverter(value.GetType()); if (valueConverter == null) { throw new InvalidOperationException(string.Format( Resources.ConversionFromNotSupported, value.GetType().FullName)); } identifier = valueConverter(value); } return(identifier); }
/// <summary> /// Converts the specified <see cref="EntityIdentifier" /> instance to an instance /// of the specified type. /// </summary> /// <param name="identifier"> /// The <see cref="EntityIdentifier" /> instance to convert. /// </param> /// <param name="type">The target type.</param> /// <returns> /// The specified <see cref="EntityIdentifier" /> converted to the specified type. /// </returns> public object ToValue(EntityIdentifier identifier, Type type) { // validate the type parameter ArgumentValidator.EnsureArgumentNotNull(type, nameof(type)); // convert the identifier and return the value object value = null; if (identifier != null) { Func <EntityIdentifier, object> valueConverter = this.GetToValueConverter(type); if (valueConverter == null) { throw new InvalidOperationException(string.Format( Resources.ConversionToNotSupported, type.FullName)); } value = valueConverter(identifier); } return(value); }
public void Implicit_Conversion_From_UInt64_Creates_Expected_Identifier() { EntityIdentifier identifier = 777548UL; identifier.Identifier.Should().Be("777548"); }
public void ToString_Returns_String_Representation_Of_Identifier() { var identifier = new EntityIdentifier("Dodo"); identifier.ToString().Should().Be("Dodo"); }
public void Implicit_Conversion_To_String_Creates_Expected_String() { string identifier = new EntityIdentifier("Tango"); identifier.Should().Be("Tango"); }