Beispiel #1
0
        public override void regAssembly()
        {
            Type[] types = this.assembly.GetTypes();
            if (types.Length < 1)
            {
                throw new Exception("在程序集" + assembly.FullName + "中,没有发现任何类");
            }

            Type type = types[0];

            WboSchema os = WboSchemaRegisterUtils.BuildObjectSchema <WboSchema>(type);

            os.Src = src;
            os.AssemblyCategory = AssemblyCategory.DotNet;
            os.AssemblyFile     = assemblyFile;
            os.Id = Path.GetFileNameWithoutExtension(assemblyFile) + "." + type.FullName;
            if (!WboSchemaContainer.Instance().Contains(os.Id))
            {
                WboSchemaContainer.Instance().AddItem(os.Id, os);
            }
            else
            {
                WboSchemaContainer.Instance().UpdateItem(os.Id, os);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 注册系统内置组件,组件Id默认为组件类名
        /// </summary>
        /// <param name="type"></param>
        public static void RegisterClass(Type type)
        {
            WboSchema os = WboSchemaRegisterUtils.BuildObjectSchema <WboSchema>(type);

            os.AssemblyCategory = AssemblyCategory.DotNet;
            if (!WboSchemaContainer.Instance().Contains(os.Id))
            {
                WboSchemaContainer.Instance().AddItem(os.Id, os);
            }
        }
Beispiel #3
0
        public static void regType(Type type, string src, AssemblyCategory srcType, string filePath)
        {
            WboSchema os = WboSchemaRegisterUtils.BuildObjectSchema <WboSchema>(type);

            os.Src = src;
            os.AssemblyCategory = AssemblyCategory.DotNet;
            os.AssemblyFile     = filePath;

            if (!WboSchemaContainer.Instance().Contains(os.Id))
            {
                WboSchemaContainer.Instance().AddItem(os.Id, os);
            }
            else
            {
                WboSchemaContainer.Instance().UpdateItem(os.Id, os);
            }
        }
Beispiel #4
0
        public T GetObject <T>(string objectName)
        {
            string comId = WboSchemaRegisterUtils.getTypeRegId(typeof(T));

            if (!WboSchemaContainer.Instance().Contains(comId))
            {
                throw new E_UmcNotFindRegObjcect(comId);
            }
            WboSchema objectSchema = WboSchemaContainer.Instance().GetItem(comId);

            object obj = GetObject(objectName, objectSchema);

            if (obj == null)
            {
                throw new E_UmcNotFindRegObjcect(objectName);
            }

            if (!(obj is T))
            {
                throw new E_UmcNoMatchObjectType(obj.GetType().ToString() + ":" + typeof(T).ToString());
            }

            return((T)obj);
        }