Beispiel #1
0
 /// <inheritdoc />
 protected override void ModifyResourceAttribute(Type type, RESTableAttribute attribute)
 {
     if (type.IsSubclassOf(typeof(ElasticSQLiteTable)))
     {
         attribute.AllowDynamicConditions = true;
         attribute.FlagStaticMembers      = true;
     }
 }
Beispiel #2
0
        public void ValidateRuntimeInsertion(Type type, string fullName, RESTableAttribute attribute)
        {
            string name;

            if (fullName != null)
            {
                name = fullName;
            }
            else
            {
                name = type.GetRESTableTypeName();
            }
            if (name == null)
            {
                throw new InvalidResourceDeclarationException(
                          "Encountered an unknown type. No further information is available.");
            }
            if (ResourceCollection.ResourceByType.ContainsKey(type))
            {
                throw new InvalidResourceDeclarationException(
                          $"Cannot add resource '{name}'. A resource with the same type ('{type.GetRESTableTypeName()}') has already been added to RESTable");
            }
            if (ResourceCollection.ResourceByName.ContainsKey(name))
            {
                throw new InvalidResourceDeclarationException(
                          $"Cannot add resource '{name}'. A resource with the same name has already been added to RESTable");
            }
            attribute ??= type.GetCustomAttribute <RESTableAttribute>();
            if (attribute == null)
            {
                throw new InvalidResourceDeclarationException(
                          $"Cannot add resource '{name}'. The type was not decorated with the RESTableAttribute attribute, and " +
                          "no additional attribute instance was included in the insertion.");
            }
            Validate(type);
        }