/// <summary>
        /// Determine if a field in sequence has been set
        /// </summary>
        /// <param name="sequence"></param>
        /// <param name="instance"></param>
        /// <returns></returns>
        private bool IsSequenceSet(Sequence sequence, object instance)
        {
            var set = false;

            // Get properties that are part of sequence
            var requiredProperties =
                instance.GetType().GetProperties()
                .Where(prop => AttributeUtil.Get <XmlIgnoreAttribute>(prop) == null)
                .Where(prop =>
            {
                var groupAttribute = AttributeUtil.Get <GroupAttribute>(prop);

                return(groupAttribute != null && groupAttribute.Id == sequence.Id);
            });

            foreach (var property in requiredProperties)
            {
                if (IsFieldSet(property, instance))
                {
                    set = true;
                }
            }

            return(set);
        }
        /// <summary>
        /// Retrieves all the properties/groups that are part of the group
        /// </summary>
        /// <param name="options"></param>
        /// <param name="instanceType"></param>
        /// <returns></returns>
        private IEnumerable <string> OptionNames(IEnumerable <ChoiceOption> options, Type instanceType)
        {
            return(options.Select(opt =>
            {
                if (opt is ChoiceFieldOption fieldOpt)
                {
                    return fieldOpt.Name;
                }
                else if (opt is ChoiceSequenceOption sequenceOpt)
                {
                    var seqProperties =
                        instanceType.GetProperties()
                        .Where(prop => AttributeUtil.Get <XmlIgnoreAttribute>(prop) == null)
                        .Where(prop =>
                    {
                        var groupAttribute = AttributeUtil.Get <GroupAttribute>(prop);

                        return groupAttribute != null && groupAttribute.Id == sequenceOpt.Sequence.Id;
                    })
                        .Select(prop => prop.Name);

                    return $"[{string.Join(", ", seqProperties)}]";
                }
                else
                {
                    throw new InvalidOperationException("Unknown choice option");
                }
            }));
        }
Beispiel #3
0
 public void GetEnumFieldDisplayNameTest()
 {
     Assert.AreEqual("不明", AttributeUtil.GetEnumFieldDisplayName(TestGender.Unknown));
     Assert.AreEqual("男性", AttributeUtil.GetEnumFieldDisplayName(TestGender.Male));
     Assert.AreEqual("女性", AttributeUtil.GetEnumFieldDisplayName(TestGender.Female));
     Assert.AreEqual("Unisex", AttributeUtil.GetEnumFieldDisplayName(TestGender.Unisex));
 }
        private void AddProperty(PropertyInfo property, IProxyGenerationHook hook)
        {
            MetaMethod getter = null;
            MetaMethod setter = null;

            if (property.CanRead)
            {
                MethodInfo getMethod = property.GetGetMethod(true);
                getter = AddMethod(getMethod, hook, false);
            }

            if (property.CanWrite)
            {
                MethodInfo setMethod = property.GetSetMethod(true);
                setter = AddMethod(setMethod, hook, false);
            }

            if (setter == null && getter == null)
            {
                return;
            }

            var nonInheritableAttributes = AttributeUtil.GetNonInheritableAttributes(property);

            properties[property] = new MetaProperty(property.Name,
                                                    property.PropertyType,
                                                    property.DeclaringType, getter, setter, PropertyAttributes.None, nonInheritableAttributes);
        }
Beispiel #5
0
        /// <summary>
        /// 创建并补全<paramref name="objectType"/>定义的远程能力特性,特性会被加到索引表
        /// </summary>
        /// <param name="objectType"></param>
        /// <returns></returns>
        private static RemotableAttribute Create(Type objectType)
        {
            var tip = AttributeUtil.GetAttribute <RemotableAttribute>(objectType);

            if (tip != null)
            {
                string typeNamespace = string.Empty;
                string typeName      = objectType.Name;

                if (!string.IsNullOrEmpty(tip.TypeNamespace))
                {
                    typeNamespace = tip.TypeNamespace;
                }
                if (!string.IsNullOrEmpty(tip.TypeName))
                {
                    typeName = tip.TypeName;
                }

                tip.TypeNamespace = typeNamespace; //重新赋值一次
                tip.TypeName      = typeName;      //重新赋值一次
                tip.RemoteType    = new RemoteType(typeNamespace, typeName);
                tip.ObjectType    = objectType;
            }
            return(tip);
        }
        public override ExPropertyInfo SearchExProperty(string name)
        {
            var propertyArray = this.SharpType.GetProperties();

            foreach (var property in propertyArray)
            {
                if (!ReflectionUtil.IsDeclare(this.SharpType, property))
                {
                    continue;
                }
                /* 映射类可能有多个同义的属性名称对应同一个实际属性 */
                ZCodeAttribute[] arrs = AttributeUtil.GetAttributes <ZCodeAttribute>(property);
                foreach (var zcode in arrs)
                {
                    if (zcode.Code == name)
                    {
                        return(new ExPropertyInfo(property, true, name));
                    }
                }
            }
            if (ParentMapping != null && !isRoot())
            {
                ExPropertyInfo epi = ParentMapping.SearchExProperty(name);
                if (epi != null)
                {
                    epi.IsSelf = false;
                    return(epi);
                }
            }
            return(null);
        }
Beispiel #7
0
        private void OnEnable()
        {
            this.script = this.serializedObject.FindProperty("m_Script");

            // Cache serialized fields
            this.fields = ReflectionUtility.GetAllFields(this.target, f => this.serializedObject.FindProperty(f.Name) != null);

            // Cache serialized properties by field name
            this.serializedPropertiesByFieldName = new Dictionary <string, SerializedProperty>();
            foreach (var field in this.fields)
            {
                this.serializedPropertiesByFieldName[field.Name] = this.serializedObject.FindProperty(field.Name);
            }


            AttributeUtil.GetFilterSystemAssemblyAllTAttributeType(_attHandles);

            foreach (var handle in _attHandles)
            {
                if (!_handles.ContainsKey(handle.Key.GetType()))
                {
                    _handles.Add(handle.Key.HandleType, (DrawerHandle)Activator.CreateInstance(handle.Value));
                }
            }
        }
Beispiel #8
0
        protected static ZFieldInfo[] GetZFields(Type markType, Type sharpType, bool isStatic)
        {
            List <ZFieldInfo> list = new List <ZFieldInfo>();

            FieldInfo[] fields = markType.GetFields();
            foreach (var field in fields)
            {
                if (ReflectionUtil.IsDeclare(markType, field) && AttributeUtil.HasAttribute <ZCodeAttribute>(field))
                {
                    FieldInfo newField = sharpType.GetField(field.Name);
                    if (newField == null)
                    {
                        throw new ZyyRTException();
                    }
                    else
                    {
                        if (isStatic == newField.IsStatic) //if ((isStatic && field.IsStatic) || (!isStatic && !field.IsStatic))
                        {
                            ZFieldInfo zproperty = new ZFieldInfo(field, newField);
                            list.Add(zproperty);
                        }
                    }
                }
            }
            return(list.ToArray());
        }
Beispiel #9
0
        protected static ZPropertyInfo[] GetZPropertys(Type markType, Type sharpType, bool isStatic)
        {
            List <ZPropertyInfo> list = new List <ZPropertyInfo>();

            PropertyInfo[] propertyArray = markType.GetProperties();
            foreach (var property in propertyArray)
            {
                if (ReflectionUtil.IsDeclare(markType, property))
                {
                    if (AttributeUtil.HasAttribute <ZCodeAttribute>(property))
                    {
                        //if ((isStatic && ReflectionUtil.IsStatic(property)) || (!isStatic && !ReflectionUtil.IsStatic(property)))
                        PropertyInfo newPropertyInfo = sharpType.GetProperty(property.Name);
                        if (newPropertyInfo == null)
                        {
                            throw new ZyyRTException();
                        }
                        else
                        {
                            if (isStatic == ReflectionUtil.IsStatic(newPropertyInfo))
                            {
                                ZPropertyInfo zproperty = new ZPropertyInfo(property, newPropertyInfo);
                                list.Add(zproperty);
                            }
                        }
                    }
                }
            }
            return(list.ToArray());
        }
Beispiel #10
0
        public static ZType CreateZType(Type type)
        {
            ZClassAttribute zAttr = AttributeUtil.GetAttribute <ZClassAttribute>(type);

            if (zAttr != null)
            {
                if (type.IsEnum)
                {
                    return(new ZEnumGenType(type));
                }
                else
                {
                    return(new ZClassGenType(type));
                }
            }
            else
            {
                ZMappingAttribute mAttr = AttributeUtil.GetAttribute <ZMappingAttribute>(type);
                if (mAttr == null)
                {
                    return(null);
                }
                if (type.IsEnum)
                {
                    return(new ZEnumMappingType(type));
                }
                else
                {
                    return(new ZEnumGenType(type));
                }
            }
            //return null;
        }
Beispiel #11
0
        protected static ZMethodInfo[] GetZMethods(Type markType, Type sharpType, bool isStatic)
        {
            List <ZMethodInfo> list = new List <ZMethodInfo>();

            MethodInfo[] methods = markType.GetMethods();
            foreach (MethodInfo method in methods)
            {
                if (ReflectionUtil.IsDeclare(markType, method))
                {
                    if (AttributeUtil.HasAttribute <ZCodeAttribute>(method))
                    {
                        MethodInfo newMethod = sharpType.GetMethod(method.Name);
                        if (newMethod == null)
                        {
                            throw new ZyyRTException();
                        }
                        else
                        {
                            if (isStatic == newMethod.IsStatic) //if ((isStatic && method.IsStatic) || (!isStatic && !method.IsStatic))
                            {
                                ZMethodInfo zproperty = new ZMethodInfo(method, newMethod);
                                list.Add(zproperty);
                            }
                        }
                    }
                }
            }
            return(list.ToArray());
        }
Beispiel #12
0
        public override TKTProcDesc[] GetProces()
        {
            List <TKTProcDesc> list = new List <TKTProcDesc>();
            var methodArray         = this.SharpType.GetMethods();

            foreach (var method in methodArray)
            {
                if (!ReflectionUtil.IsDeclare(SharpType, method))
                {
                    continue;
                }
                /* 编译器生成的类肯定有标注 */
                ZCodeAttribute     procAttr = AttributeUtil.GetAttribute <ZCodeAttribute>(method);
                ProcDescCodeParser parser   = new ProcDescCodeParser();
                parser.InitType(SharpType, method);
                TKTProcDesc  typeProcDesc = parser.Parser(procAttr.Code);
                ExMethodInfo exMethod     = ZTypeUtil.CreatExMethodInfo(method, this.SharpType);
                typeProcDesc.ExMethod = exMethod;
                list.Add(typeProcDesc);
            }
            if (ParentMapping != null)
            {
                TKTProcDesc[] epi = ParentMapping.GetProces();
                foreach (var pitem in epi)
                {
                    pitem.ExMethod.IsSelf = false;
                }
                list.AddRange(epi);
            }
            return(list.ToArray());
        }
Beispiel #13
0
        public static PropertyField[] GetProperties(UnityEngine.Object obj)
        {
            List <PropertyField> fields = new List <PropertyField>();

            PropertyInfo[] propertyInfos = obj.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);

            foreach (PropertyInfo info in propertyInfos)
            {
                if (!(info.CanRead && info.CanWrite))
                {
                    continue;
                }

                if (!AttributeUtil.HasAttribute <ExposePropertyAttribute>(info))
                {
                    continue;
                }

                SerializedPropertyType type;
                if (PropertyField.GetPropertyType(info, out type))
                {
                    PropertyField field = new PropertyField(obj, info, type);
                    fields.Add(field);
                }
            }

            return(fields.ToArray());
        }
Beispiel #14
0
 private static void CopyNonInheritableAttributes(GenericTypeParameterBuilder newGenericParameter, Type originalGenericArgument)
 {
     foreach (var attribute in AttributeUtil.GetNonInheritableAttributes(originalGenericArgument))
     {
         newGenericParameter.SetCustomAttribute(attribute);
     }
 }
            public override object[] GetCustomAttributes(Type attributeType, bool inherit)
            {
                List <object> result = new List <object>();

                // Then add all the attributes from the attribute table.
                result.AddRange(ReflectionContext.Table.GetCustomAttributes(this).Where(attr => attributeType.IsAssignableFrom(attr.GetType())));

                // Then check this type, without inheritance. (Parameter attributes are not inherited). Add only attributes if Multiple = true OR attribute not already exists.
                foreach (var ca in base.GetCustomAttributes(attributeType, false))
                {
                    if (AttributeUtil.GetAttributeUsage(ca.GetType()).AllowMultiple || !result.Any(attr => attr.GetType().Equals(ca.GetType())))
                    {
                        result.Add(ca);
                    }
                }

                // Finally create a resulting array of the correct type.
                object[] arrResult = (object[])Array.CreateInstance(attributeType, result.Count);
                for (int i = 0; i < result.Count; i++)
                {
                    arrResult[i] = result[i];
                }

                return(arrResult);
            }
Beispiel #16
0
        /// <summary>
        /// Serialize the root object for a request.
        /// This should always be BroadsoftDocument
        /// </summary>
        /// <param name="document"></param>
        /// <returns></returns>
        private XElement SerializeRoot <T>(BroadsoftDocument <T> document) where T : OCICommand
        {
            var documentType = typeof(BroadsoftDocument <T>);

            var ns = XNamespace.None;

            // By default, element name will by the class name
            var elementName = "BroadsoftDocument";

            // XmlRoot attribute will contain useful information such as namespace
            var xmlRootAttr = AttributeUtil.Get <XmlRootAttribute>(documentType);

            if (xmlRootAttr != null)
            {
                // Override defaults if attribute properties are set
                if (xmlRootAttr.Namespace != null)
                {
                    ns = xmlRootAttr.Namespace;
                }

                if (!string.IsNullOrEmpty(xmlRootAttr.ElementName))
                {
                    elementName = xmlRootAttr.ElementName;
                }
            }

            // Element contents is an object contianing all attributes and elements under this element
            return(new XElement(ns + elementName,
                                new XAttribute(XNamespace.Xmlns + "xsi", "http://www.w3.org/2001/XMLSchema-instance"),
                                new XAttribute(XNamespace.Xmlns + "xsd", "http://www.w3.org/2001/XMLSchema"),
                                GetElementContentsForInstance(documentType, document)));
        }
Beispiel #17
0
        public override ExPropertyInfo[] GetPropertyInfoes()
        {
            List <ExPropertyInfo> exList = new List <ExPropertyInfo>();
            var propertyArray            = this.SharpType.GetProperties();

            foreach (var property in propertyArray)
            {
                ZCodeAttribute[] arrs = AttributeUtil.GetAttributes <ZCodeAttribute>(property);
                foreach (var zcattr in arrs)
                {
                    ExPropertyInfo exPI = new ExPropertyInfo(property, true, zcattr.Code);
                    exList.Add(exPI);
                }
            }
            if (ParentMapping != null && !isRoot())
            {
                ExPropertyInfo[] pArr = ParentMapping.GetPropertyInfoes();
                foreach (ExPropertyInfo pitem in pArr)
                {
                    pitem.IsSelf = false;
                }
                exList.AddRange(pArr);
            }
            return(exList.ToArray());
        }
Beispiel #18
0
        private PropertyExtractor GetAttributeExtractBy(Type type, PropertyInfo property)
        {
            PropertyExtractor propertyExtractor = null;
            var extractBy = AttributeUtil.GetAttribute <ExtractByAttribute>(property);

            if (extractBy != null)
            {
                var selector  = ExtractorUtils.GetSelector(extractBy);
                var sourceTmp = extractBy.Source;
                if (extractBy.Type == ExtractType.JsonPath)
                {
                    sourceTmp = ExtractSource.RawText;
                }
                Source source = Source.Html;
                switch (sourceTmp)
                {
                case ExtractSource.RawText:
                    source = Source.RawText;
                    break;

                case ExtractSource.RawHtml:
                    source = Source.RawHtml;
                    break;

                case ExtractSource.SelectedHtml:
                    source = Source.Html;
                    break;
                }
                propertyExtractor = new PropertyExtractor(property, selector, source,
                                                          extractBy.NotNull, true);
            }
            return(propertyExtractor);
        }
Beispiel #19
0
        private FieldExtractor GetAttributeExtractCombo(Type type, FieldInfo field)
        {
            FieldExtractor fieldExtractor = null;
            var            comboExtract   = AttributeUtil.GetAttribute <ComboExtractAttribute>(field);

            if (comboExtract != null)
            {
                var       extractBys = comboExtract.Value;
                var       selectors  = ExtractorUtils.GetSelectors(extractBys);
                ISelector selector   = new AndSelector(selectors);
                switch (comboExtract.Op)
                {
                case Op.And:
                    selector = new AndSelector(selectors);
                    break;

                case Op.Or:
                    selector = new OrSelector(selectors);
                    break;
                }
                var source = comboExtract.Source == ExtractSource.RawHtml ? Source.RawHtml : Source.Html;
                fieldExtractor = new FieldExtractor(field, selector, source,
                                                    comboExtract.NotNull, comboExtract.IsMulti ||
                                                    typeof(List <object>).IsAssignableFrom(field.GetType()))
                {
                    SetterMethod = GetSetterMethod(type, field) ?? null
                };
            }
            return(fieldExtractor);
        }
Beispiel #20
0
        private PropertyExtractor GetAttributeExtractCombo(Type type, PropertyInfo property)
        {
            PropertyExtractor propertyExtractor = null;
            var comboExtract = AttributeUtil.GetAttribute <ComboExtractAttribute>(property);

            if (comboExtract != null)
            {
                var       extractBys = comboExtract.Value;
                var       selectors  = ExtractorUtils.GetSelectors(extractBys);
                ISelector selector   = new AndSelector(selectors);
                switch (comboExtract.Op)
                {
                case Op.And:
                    selector = new AndSelector(selectors);
                    break;

                case Op.Or:
                    selector = new OrSelector(selectors);
                    break;
                }
                var source = comboExtract.Source == ExtractSource.RawHtml ? Source.RawHtml : Source.Html;
                propertyExtractor = new PropertyExtractor(property, selector, source,
                                                          comboExtract.NotNull, comboExtract.IsMulti ||
                                                          typeof(List <object>).IsAssignableFrom(property.GetType()));
            }
            return(propertyExtractor);
        }
Beispiel #21
0
        /// <summary>
        /// 发布消息
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entity">对像实例</param>
        /// <param name="isCreateQueue">是否创建对列</param>
        public void Publish <T>(T entity, bool isCreateQueue = false) where T : class
        {
            //获取当前队列的特性
            var queueAttrInfo = AttributeUtil.GetRabbitMQAttribute <T>();

            if (queueAttrInfo.IsNullOrEmpty())
            {
                throw new ArgumentException("RabbitMQAttribute未定义");
            }

            var queueName = queueAttrInfo.QueueName;
            var body      = entity.SerializeObjectToBytes();

            RabbitMessageQueueOptions queueOptions = RabbitQueueOptionsUtil.ReaderByQueue(queueName);
            var exchangeType = queueOptions.ExchangeType;
            var exchange     = queueOptions.ExchangeName;
            var routingKey   = queueOptions.RoutingKeys;

            if (isCreateQueue)
            {
                Publish(exchangeType, exchange, routingKey, body, queueName);
            }
            else
            {
                Publish(exchangeType, exchange, routingKey, body);
            }
        }
Beispiel #22
0
        //public static IZDescType CreateZDescType(Type type)
        //{
        //    if (ztypeCache.ContainsKey(type))
        //    {
        //        return ztypeCache[type];
        //    }
        //    else
        //    {
        //        IZDescType ztype = CreateZTypeImp(type);
        //        if (ztype != null)
        //        {
        //            if (!sharpCache.ContainsKey(ztype.SharpType))
        //                sharpCache.Add(ztype.SharpType, ztype);
        //            if (!ztypeCache.ContainsKey(type))
        //                ztypeCache.Add(type, ztype);
        //        }
        //        return ztype;
        //    }
        //}

        private static IZDescType CreateZTypeImp(Type type)
        {
            if (AttributeUtil.HasAttribute <ZDimAttribute>(type))
            {
                ZDimType zdim = new ZDimType(type);
                return(zdim);
            }
            else if (AttributeUtil.HasAttribute <ZEnumAttribute>(type))
            {
                ZEnumType zenum = new ZEnumType(type);
                return(zenum);
            }
            else if (AttributeUtil.HasAttribute <ZStaticAttribute>(type))
            {
                ZStaticAttribute zAttr     = AttributeUtil.GetAttribute <ZStaticAttribute>(type);
                Type             sharpType = (zAttr.SharpType == null ? type : zAttr.SharpType);
                ZClassType       zclass    = new ZClassType(type, sharpType, true);
                return(zclass);
            }
            else if (AttributeUtil.HasAttribute <ZInstanceAttribute>(type))
            {
                ZInstanceAttribute zAttr = AttributeUtil.GetAttribute <ZInstanceAttribute>(type);
                Type       sharpType     = (zAttr.SharpType == null ? type : zAttr.SharpType);
                ZClassType zclass        = new ZClassType(type, sharpType, false);
                return(zclass);
            }
            return(null);
        }
Beispiel #23
0
        public string GetWinner(string playerInfo)
        {
            // the players in this game, assume there are always only 2
            var players = JsonConvert.DeserializeObject <List <Player> >(playerInfo);
            var winner  = DeckService.DetermineWinner(players[0], players[1]);

            return($"Winner is {winner.PlayerName} with {AttributeUtil.GetAttributeValue<NameAttribute>(typeof(HandResult.HandResults), HandResult.DetermineHandResult(winner.PlayerHand).Item1.ToString(), nameof(NameAttribute.Name))}");
        }
Beispiel #24
0
        public void TestAttributeUtilGetPropertyInfo()
        {
            TestClass2   item = new TestClass2(7, "test", 0);
            PropertyInfo pi   = AttributeUtil.GetPropertyInfo(() => item.Id);

            Assert.IsNotNull(pi);
            Assert.AreEqual("Id", pi.Name);
        }
        /// <summary>
        /// Validates primitive types
        /// </summary>
        /// <param name="property"></param>
        /// <param name="value"></param>
        /// <returns>A list of all errors encountered.</returns>
        private static IEnumerable <ValidationError> ValidatePropertyRestrictions(object instance, PropertyInfo property, object value)
        {
            var errors = new List <ValidationError>();

            // Get all attributes on property
            var attributes = AttributeUtil.GetAll(property);

            foreach (var attribute in attributes)
            {
                switch (attribute)
                {
                case LengthAttribute attr:
                    if (value != null && value.ToString().Length != attr.Length)
                    {
                        errors.Add(new LengthError(instance, property.Name, value.ToString().Length, attr.Length));
                    }
                    break;

                case MinLengthAttribute attr:
                    if (value != null && value.ToString().Length < attr.Length)
                    {
                        errors.Add(new MinLengthError(instance, property.Name, value.ToString().Length, attr.Length));
                    }
                    break;

                case MaxLengthAttribute attr:
                    if (value != null && value.ToString().Length > attr.Length)
                    {
                        errors.Add(new MaxLengthError(instance, property.Name, value.ToString().Length, attr.Length));
                    }
                    break;

                case MinInclusiveAttribute attr:
                    if (value != null && (int)value < attr.Minimum)
                    {
                        errors.Add(new MinInclusiveError(instance, property.Name, (int)value, attr.Minimum));
                    }
                    break;

                case MaxInclusiveAttribute attr:
                    if (value != null && (int)value > attr.Maximum)
                    {
                        errors.Add(new MaxInclusiveError(instance, property.Name, (int)value, attr.Maximum));
                    }
                    break;

                case RegularExpressionAttribute attr:
                    if (value != null && !Regex.IsMatch(value.ToString(), attr.Pattern))
                    {
                        errors.Add(new PatternError(instance, property.Name, value.ToString(), attr.Pattern));
                    }

                    break;
                }
            }

            return(errors);
        }
 private string GetFieldDisplayName(string field)
 {
     return(AttributeUtil.GetAttributeValue(
                typeof(OneStepApplyVendorModel),
                field,
                typeof(NopResourceDisplayName),
                nameof(NopResourceDisplayName.DisplayName)
                ).ToString());
 }
Beispiel #27
0
 public static ZLDimInfo CreateZLDimImp(Type type)
 {
     if (AttributeUtil.HasAttribute <ZDimAttribute>(type))
     {
         ZLDimInfo zdim = new ZLDimInfo(type);
         return(zdim);
     }
     return(null);
 }
 public ObjectInfo(Type t)
 {
     Methods = makeDictionary(AttributeUtil.GetMethodsWithAttribute <ConsoleAttribute>(t));
     postProcessMethods(Methods);
     Fields = makeDictionary(AttributeUtil.GetFieldsWithAttribute <ConsoleAttribute>(t));
     postProcessFields(Fields);
     Properties = makeDictionary(AttributeUtil.GetPropertiesWithAttribute <ConsoleAttribute>(t));
     postProcessProperties(Properties);
 }
Beispiel #29
0
        /// <summary>
        /// 检查类型是否为并发访问安全的
        /// </summary>
        /// <param name="type"></param>
        public static void CheckUp(Type type)
        {
            var access = AttributeUtil.GetAttribute <AppSessionAccessAttribute>(type);

            if (access == null)
            {
                throw new TypeUnAppSessionAccessException(type);
            }
        }
Beispiel #30
0
        /// <summary>
        /// 检查类型是否为并发访问安全的
        /// </summary>
        /// <param name="type"></param>
        public static void CheckUp(Type type)
        {
            var access = AttributeUtil.GetAttribute <SafeAccessAttribute>(type, false);

            if (access == null)
            {
                throw new TypeUnsafeAccessException(type);
            }
        }