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 ExtensionInfo RegisterExpression(ExtensionInfo extension) { RegisteredExtensions.GetOrAddDefinition(extension.SourceType)[extension.Key] = extension; RegisteredExtensions.ClearCache(); return(extension); }
public ExtensionInfo Register(ExtensionInfo extension, bool replace = false) { var dic = RegisteredExtensions.GetOrAddDefinition(extension.SourceType); if (replace) { dic[extension.Key] = extension; } else { dic.Add(extension.Key, extension); } RegisteredExtensions.ClearCache(); return(extension); }
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(); }