예제 #1
0
        public string GetPrimaryAttributeName(PrimaryAttributeType primaryAttributeType)
        {
            switch (primaryAttributeType)
            {
            case PrimaryAttributeType.Id:
                return(PrimaryIdAttributeName);

            case PrimaryAttributeType.Name:
                return(PrimaryNameAttributeName);

            case PrimaryAttributeType.Image:
                return(PrimaryImageAttributeName);

            default:
                throw new ArgumentOutOfRangeException(nameof(primaryAttributeType), primaryAttributeType, null);
            }
        }
예제 #2
0
        public bool IsPrimaryAttribute(string attributeName, PrimaryAttributeType type)
        {
            switch (type)
            {
            case PrimaryAttributeType.Id:
                return(PrimaryIdAttributeName == attributeName);

            case PrimaryAttributeType.Name:
                return(PrimaryNameAttributeName == attributeName);

            case PrimaryAttributeType.Image:
                return(PrimaryImageAttributeName == attributeName);

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
 public PrimaryAttributeAttribute(PrimaryAttributeType type)
 {
     Type = type;
 }
 public PrimaryAttributeAttribute(PrimaryAttributeType type)
 {
     Type = type;
 }
예제 #5
0
        public bool IsPrimaryAttribute(string attributeName, PrimaryAttributeType type)
        {
            var field = DefinitionType.GetNestedType("Columns").GetFields().FirstOrDefault(f => (f.GetValue(null) as string) == attributeName);

            if (field != null)
            {
                var primary = field.GetCustomAttribute<PrimaryAttributeAttribute>();

                return primary != null && primary.Type == type;
            }
            return false;
        }