void AddTypes(IEnumerable <ITypeDefinition> types)
 {
     foreach (ITypeDefinition typeDefinition in types)
     {
         CodeType codeType = CodeType.Create(context, typeDefinition);
         if (string.IsNullOrEmpty(typeDefinition.Namespace))
         {
             codeElements.Add(codeType);
         }
         else
         {
             GetNamespace(typeDefinition.Namespace).AddMember(codeType);
         }
     }
 }
示例#2
0
		public static void AddUsings(CodeElementsList<CodeElement> codeElements, UsingScope usingScope, ICompilation compilation)
		{
			var resolvedUsingScope = usingScope.Resolve(compilation);
			foreach (var ns in resolvedUsingScope.Usings) {
				codeElements.Add(new CodeImport(ns.FullName));
			}
		}
        protected CodeElementsList <CodeAttribute2> GetAttributes(IEntity entity)
        {
            var attributes = new CodeElementsList <CodeAttribute2>();

            foreach (IAttribute attribute in entity.Attributes)
            {
                if (IsInFilter(attribute.Region))
                {
                    attributes.Add(new CodeAttribute2(context, attribute));
                }
            }
            return(attributes);
        }
示例#4
0
 protected CodeElementsList<CodeAttribute2> GetAttributes(IEntity entity)
 {
     var attributes = new CodeElementsList<CodeAttribute2>();
     foreach (IAttribute attribute in entity.Attributes) {
         if (IsInFilter(attribute.Region)) {
             attributes.Add(new CodeAttribute2(context, attribute));
         }
     }
     return attributes;
 }
示例#5
0
 internal void AddMember(CodeElement member)
 {
     members.Add(member);
 }
示例#6
0
		protected CodeElementsList<CodeAttribute2> GetAttributes(IEntityModel entityModel)
		{
			var list = new CodeElementsList<CodeAttribute2>();
			var td = entityModel.Resolve();
			if (td != null) {
				foreach (var attr in td.Attributes) {
					if (IsInFilter(attr.Region))
						list.Add(new CodeAttribute2(context, attr));
				}
			}
			return list;
		}