Exemple #1
0
 /// <summary>
 ///     Specifies code generator for member
 /// </summary>
 public static IAttributed <TsParameterAttribute> WithCodeGenerator <T>(
     this IAttributed <TsParameterAttribute> conf)
     where T : TsCodeGeneratorBase <ParameterInfo, RtArgument>
 {
     conf.AttributePrototype.CodeGeneratorType = typeof(T);
     return(conf);
 }
Exemple #2
0
 /// <summary>
 ///     Specifies code generator for member
 /// </summary>
 public static IAttributed <TsPropertyAttribute> WithCodeGenerator <T>(
     this IAttributed <TsPropertyAttribute> conf)
     where T : ITsCodeGenerator <MemberInfo>
 {
     conf.AttributePrototype.CodeGeneratorType = typeof(T);
     return(conf);
 }
Exemple #3
0
 /// <summary>
 ///     Specifies code generator for member
 /// </summary>
 public static IAttributed <TsFunctionAttribute> WithCodeGenerator <T>(
     this IAttributed <TsFunctionAttribute> conf)
     where T : ITsCodeGenerator <MethodInfo>
 {
     conf.AttributePrototype.CodeGeneratorType = typeof(T);
     return(conf);
 }
Exemple #4
0
 /// <summary>
 ///     Specifies code generator for member
 /// </summary>
 public static IAttributed <TsEnumAttribute> WithCodeGenerator <T>(
     this IAttributed <TsEnumAttribute> conf)
     where T : ITsCodeGenerator <Type>
 {
     conf.AttributePrototype.CodeGeneratorType = typeof(T);
     return(conf);
 }
        /// <summary>
        /// Get attributes ids for proxy object
        /// </summary>
        /// <param name="proxy">E3.series proxy object</param>
        /// <param name="attributeName">Returns only attributes with name <c>attributeName</c></param>
        /// <returns>IEnumerable of ids or empty collection</returns>
        public static IEnumerable <int> GetAttributeIdsEnumerable(this IAttributed proxy, string attributeName = "")
        {
            if (attributeName == null)
            {
                throw new ArgumentNullException(nameof(attributeName));
            }

            object attIds = null;

            if (!string.IsNullOrWhiteSpace(attributeName))
            {
                if (!proxy.HasAttribute(attributeName).CastToBool())
                {
                    return new int[] { }
                }
                ;

                proxy.GetAttributeIds(ref attIds, attributeName);
                return(attIds.ToIEnumerable());
            }

            if (proxy.GetAttributeCount() == 0)
            {
                return new int[] { }
            }
            ;

            proxy.GetAttributeIds(ref attIds);

            return(attIds.ToIEnumerable());
        }
    }
}
        public static string GetAttributes(this IAttributed item)
        {
            if (item == null)
            {
                return(string.Empty);
            }

            return(string.Join(",", item.Attributes.Select(GetAttributeAssignment)));
        }
Exemple #7
0
        public static bool CheckIgnored <T>(this IAttributed <T> conf)
        {
            var ignore = conf as IIgnorable;

            if (ignore == null)
            {
                return(false);
            }
            return(ignore.Ignore);
        }
Exemple #8
0
 /// <summary>
 ///     Overrides member type on export with strong type.
 ///     Feel free to use delegates here. It is very comfortable instead of regular TS functions syntax.
 ///     Actually this method does the same as .Type call. Just for your convinence
 /// </summary>
 /// <param name="conf">Configurator</param>
 public static IAttributed <TsTypedAttributeBase> Returns <T>(
     this IAttributed <TsFunctionAttribute> conf)
 {
     conf.AttributePrototype.StrongType = typeof(T);
     return(conf);
 }