public static void RegisterReplace(this IOperation operation) { if (!operation.OverridenType.IsIEntity()) { throw new InvalidOperationException("Type {0} has to implement at least {1}".FormatWith(operation.OverridenType)); } operation.AssertIsValid(); operations.GetOrAddDefinition(operation.OverridenType)[operation.OperationSymbol] = operation; operationsFromKey.Reset(); //unnecesarry? }
public static void Register(this IOperation operation) { if (!operation.OverridenType.IsIEntity()) { throw new InvalidOperationException("Type '{0}' has to implement at least {1}".FormatWith(operation.OverridenType.Name)); } operation.AssertIsValid(); operations.GetOrAddDefinition(operation.OverridenType).AddOrThrow(operation.OperationSymbol, operation, "Operation {0} has already been registered"); operationsFromKey.Reset(); }
public static void Register(this IOperation operation, bool replace = false) { if (!operation.OverridenType.IsIEntity()) { throw new InvalidOperationException("Type '{0}' has to implement at least {1}".FormatWith(operation.OverridenType.Name)); } operation.AssertIsValid(); var dic = operations.GetOrAddDefinition(operation.OverridenType); if (replace) { dic[operation.OperationSymbol] = operation; } else { dic.AddOrThrow(operation.OperationSymbol, operation, "Operation {0} has already been registered"); } operations.ClearCache(); operationsFromKey.Reset(); }