Пример #1
0
 protected override void CheckFieldDescriptor(string fieldName, IFieldInfoTypeDescriptor fieldDescriptor)
 {
     if (fieldDescriptor.IsArray)
     {
         throw new BadFluentConfigurationException("Array fields is not suported on Delimited files!");
     }
 }
 protected override void CheckFieldDescriptor(string fieldName, IFieldInfoTypeDescriptor fieldDescriptor)
 {
     if (fieldDescriptor.IsArray)
     {
         CheckFieldArrayDescriptor(fieldName, fieldDescriptor as IArrayFieldInfoDescriptor);
         return;
     }
     CheckFieldDescriptor(fieldName, fieldDescriptor as IFixedFieldInfoDescriptor);
 }
 public void Add(string fieldName, IFieldInfoTypeDescriptor fieldDescriptor)
 {
     if (Fields.ContainsKey(fieldName))
     {
         Fields[fieldName] = fieldDescriptor;
         return;
     }
     Fields.Add(fieldName, fieldDescriptor);
 }
Пример #4
0
        public static FixedArrayFieldInfoBuilder AddArray(this IFieldInfoTypeDescriptor fieldInfo, string fieldName)
        {
            if (!fieldInfo.IsArray)
            {
                throw new BadFluentConfigurationException($"The parent field must be an array field.");
            }

            var arrayFieldInfoBuilder = fieldInfo as FixedArrayFieldInfoBuilder;

            if (arrayFieldInfoBuilder == null)
            {
                throw new BadFluentConfigurationException("The parent field must be an FixedArrayFieldInfoBuilder instance");
            }

            var subFieldInfo = new FixedArrayFieldInfoBuilder();

            arrayFieldInfoBuilder.Add(fieldName, subFieldInfo);

            return(subFieldInfo);
        }
 protected abstract void CheckFieldDescriptor(string fieldName, IFieldInfoTypeDescriptor fieldDescriptor);
        private static void AddProperty(this CodeTypeDeclaration targetClass, string propertyName, IFieldInfoTypeDescriptor fieldDescriptor)
        {
            var codeSnippet = new CodeSnippetTypeMember
            {
                Text = string.Concat("        public ", ((IFieldInfoDescriptor)fieldDescriptor).ResolveType(), " ", propertyName, " { get; set; }")
            };

            targetClass.Members.Add(codeSnippet);
        }
 protected virtual void CheckFieldDescriptor(string fieldName, IFieldInfoTypeDescriptor fieldDescriptor)
 {
 }
 protected override void CheckFieldDescriptor(string fieldName, IFieldInfoTypeDescriptor fieldDescriptor)
 {
 }