Example #1
0
        internal void ConfigureAddin(AssemblyInformation addin)
        {
            List <ResourceBOMAttribute> resourceAttr = new List <ResourceBOMAttribute>();
            Assembly assembly;

            try
            {
                assembly = Assembly.Load(addin.Name);
            }
            catch (InvalidOperationException e)
            {
                Logger.Error(String.Format(Messages.AddInNotFound, addin), e);
                return;
            }
            ContainerManager.CheckProxy(assembly);

            var types = (from type in assembly.GetTypes()
                         where type.IsClass
                         select type);

            foreach (var type in types)
            {
                var attrs = type.GetCustomAttributes(true);
                foreach (var attr in attrs)
                {
                    Logger.Debug(DebugString.Format(Messages.ProcessingAttribute, attr, type));
                    if (attr is ResourceBOMAttribute)
                    {
                        resourceAttr.Add((ResourceBOMAttribute)attr);
                    }
                    else if (attr is PermissionAttribute)
                    {
                        b1DAO.UpdateOrSavePermissionIfNotExists((PermissionAttribute)attr);
                    }
                }
            }
            resourceAttr.Sort(); // need to order becase we need create tables, than fields and at the end UDOs.
            foreach (var resource in resourceAttr)
            {
                ProcessAddInResourceAttribute(resource, assembly);
            }
        }