当前位置: 首页>>代码示例>>C#>>正文


C# IConceptInfo.GetType方法代码示例

本文整理汇总了C#中IConceptInfo.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IConceptInfo.GetType方法的具体用法?C# IConceptInfo.GetType怎么用?C# IConceptInfo.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IConceptInfo的用法示例。


在下文中一共展示了IConceptInfo.GetType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetPluginMethods

        private static List<MethodInfo> GetPluginMethods(IConceptMacro conceptMacro, IConceptInfo conceptInfo)
        {
            var methods = conceptMacro.GetType().GetInterfaces()
                    .Where(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IConceptMacro<>)
                        && i.GetGenericArguments().Single().IsAssignableFrom(conceptInfo.GetType()))
                    .Select(i => i.GetMethod("CreateNewConcepts"))
                    .ToList();

            if (methods.Count == 0)
                throw new FrameworkException(string.Format(
                    "Plugin {0} does not implement generic interface {1} that accepts argument {2}.",
                    conceptMacro.GetType().FullName,
                    typeof(IConceptMacro<>).FullName,
                    conceptInfo.GetType().FullName));

            return methods;
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:17,代码来源:ConceptMacroUtility.cs

示例2: NewConceptApplication

 public NewConceptApplication(IConceptInfo conceptInfo, IConceptDatabaseDefinition conceptImplementation)
 {
     Id = Guid.Empty;
     ConceptInfo = conceptInfo;
     ConceptInfoTypeName = conceptInfo.GetType().AssemblyQualifiedName;
     ConceptInfoKey = conceptInfo.GetKey();
     ConceptImplementation = conceptImplementation;
     ConceptImplementationType = conceptImplementation.GetType();
     ConceptImplementationTypeName = ConceptImplementationType.AssemblyQualifiedName;
     ConceptImplementationVersion = GetVersionFromAttribute(ConceptImplementationType);
 }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:11,代码来源:NewConceptApplication.cs

示例3: BaseConceptInfoType

 private static Type BaseConceptInfoType(IConceptInfo ci)
 {
     Type t = ci.GetType();
     while (typeof(IConceptInfo).IsAssignableFrom(t.BaseType) && t.BaseType.IsClass)
         t = t.BaseType;
     return t;
 }
开发者ID:Rhetos,项目名称:Rhetos,代码行数:7,代码来源:ConceptInfoHelper.cs

示例4: AppendMembers

        private static void AppendMembers(StringBuilder text, IConceptInfo ci, SerializationOptions serializationOptions, bool exceptionOnNullMember = false, Type asBaseConceptType = null)
        {
            IEnumerable<ConceptMember> members = ConceptMembers.Get(asBaseConceptType ?? ci.GetType());
            if (serializationOptions == SerializationOptions.KeyMembers)
                members = members.Where(member => member.IsKey);

            bool firstMember = true;
            foreach (ConceptMember member in members)
            {
                string separator = member.IsKey ? "." : " ";
                if (!firstMember)
                    text.Append(separator);
                firstMember = false;

                AppendMember(text, ci, member, exceptionOnNullMember);
            }
        }
开发者ID:Rhetos,项目名称:Rhetos,代码行数:17,代码来源:ConceptInfoHelper.cs

示例5: AppendMember

 private static void AppendMember(StringBuilder text, IConceptInfo ci, ConceptMember member, bool exceptionOnNullMember)
 {
     object memberValue = member.GetValue(ci);
     if (memberValue == null)
         if (exceptionOnNullMember)
             throw new DslSyntaxException(ci, string.Format(
                 "{0}'s property {1} is null. Info: {2}.",
                 ci.GetType().Name, member.Name, ci.GetErrorDescription()));
         else
             text.Append("<null>");
     else if (member.IsConceptInfo)
     {
         IConceptInfo value = (IConceptInfo)member.GetValue(ci);
         if (member.ValueType == typeof(IConceptInfo))
             text.Append(BaseConceptInfoType(value).Name).Append(":");
         AppendMembers(text, value, SerializationOptions.KeyMembers, exceptionOnNullMember);
     }
     else if (member.ValueType == typeof(string))
         text.Append(SafeDelimit(member.GetValue(ci).ToString()));
     else
         throw new FrameworkException(string.Format(
             "IConceptInfo member {0} of type {1} in {2} is not supported.",
             member.Name, member.ValueType.Name, ci.GetType().Name));
 }
开发者ID:Rhetos,项目名称:Rhetos,代码行数:24,代码来源:ConceptInfoHelper.cs

示例6: ParseMembers

        private ValueOrError<IConceptInfo> ParseMembers(ITokenReader tokenReader, IConceptInfo lastConcept, bool readingAReference)
        {
            IConceptInfo conceptInfo = (IConceptInfo)Activator.CreateInstance(ConceptInfoType);
            bool firstMember = true;
            bool lastPropertyWasInlineParent = false;
            bool lastConceptUsed = false;

            var listOfMembers = readingAReference ? Members.Where(m => m.IsKey) : Members.Where(m => m.IsParsable);
            foreach (ConceptMember member in listOfMembers)
            {
                var valueOrError = ReadMemberValue(member, tokenReader, lastConcept, firstMember, ref lastPropertyWasInlineParent, ref lastConceptUsed, readingAReference);

                if (valueOrError.IsError)
                    return ValueOrError<IConceptInfo>.CreateError(string.Format(CultureInfo.InvariantCulture,
                        "Cannot read the value of {0} in {1}. {2}",
                        member.Name, ConceptInfoType.Name, valueOrError.Error));

                member.SetMemberValue(conceptInfo, valueOrError.Value);
                firstMember = false;
            }

            if (!lastConceptUsed && lastConcept != null)
                return ValueOrError<IConceptInfo>.CreateError(string.Format(
                    "This concept cannot be enclosed within {0}. Trying to read {1}.",
                    lastConcept.GetType().Name, ConceptInfoType.Name));

            return ValueOrError<IConceptInfo>.CreateValue(conceptInfo);
        }
开发者ID:koav,项目名称:Rhetos,代码行数:28,代码来源:GenericParser.cs

示例7: SetMemberValue

        public void SetMemberValue(IConceptInfo conceptInfo, object value)
        {
            PropertyInfo pi;
            FieldInfo fi;

            if ((pi = MemberInfo as PropertyInfo) != null)
                try
                {
                    pi.SetValue(conceptInfo, value, null);
                }
                catch (ArgumentException ae)
                {
                    throw new FrameworkException(
                        string.Format(CultureInfo.InvariantCulture,
                            "Unable to convert property {0} in concept {1} from type {2} to type {3}",
                                pi.Name,
                                conceptInfo.GetType().FullName,
                                pi.PropertyType.FullName,
                                value != null ? value.GetType().FullName : "unknown"),
                        ae);
                }
            else if ((fi = MemberInfo as FieldInfo) != null)
                try
                {
                    fi.SetValue(conceptInfo, value);
                }
                catch (ArgumentException ae)
                {
                    throw new FrameworkException(
                        string.Format(CultureInfo.InvariantCulture,
                            "Unable to convert property {0} in concept {1} from type {2} to type {3}",
                                pi.Name,
                                conceptInfo.GetType().FullName,
                                pi.PropertyType.FullName,
                                value != null ? value.GetType().FullName : "unknown"),
                        ae);
                }
            else
                throw new FrameworkException(
                    string.Format(CultureInfo.InvariantCulture,
                        "Unexpected member type {0} for member {1}.",
                            MemberInfo.MemberType,
                            MemberInfo.Name));
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:44,代码来源:ConceptMember.cs

示例8: ReportErrorContext

 protected string ReportErrorContext(IConceptInfo conceptInfo, int index)
 {
     var sb = new StringBuilder();
     sb.AppendLine(_dslSource.ReportError(index));
     if (conceptInfo != null)
     {
         sb.AppendFormat("Previous concept: {0}", conceptInfo.GetUserDescription()).AppendLine();
         var properties = conceptInfo.GetType().GetProperties().ToList();
         properties.ForEach(it =>
             sb.AppendFormat("Property {0} ({1}) = {2}",
                 it.Name,
                 it.PropertyType.Name,
                 it.GetValue(conceptInfo, null) ?? "<null>")
                 .AppendLine());
     }
     return sb.ToString();
 }
开发者ID:koav,项目名称:Rhetos,代码行数:17,代码来源:DslParser.cs

示例9: Get

 public static ConceptMember[] Get(IConceptInfo conceptInfo)
 {
     return Get(conceptInfo.GetType(), new Lazy<IConceptInfo>(() => conceptInfo));
 }
开发者ID:koav,项目名称:Rhetos,代码行数:4,代码来源:ConceptMembers.cs


注:本文中的IConceptInfo.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。