Example #1
0
        public TAttribute GetMetadataAttribute <TAttribute>(ImmutableArray <AttributeData> attributes)
        {
            foreach (var attr in attributes)
            {
                if (attr.AttributeClass != null && typeUtils.IsSymbolEqualToType(attr.AttributeClass, typeof(TAttribute)))
                {
                    return(AttributeFactory.Create <TAttribute>(attr));
                }
            }

            throw new GenerationFailureException
                  {
                      Id          = "LJ0005",
                      Title       = "Unable to get Framework Metadata",
                      Description = $"An error occurred while attempting to fetch metadata from {typeof(TAttribute).Name}",
                      Location    = Location.None,
                  };
        }
Example #2
0
 public static void StartExtension()
 {
     lock (locker)
     {
         if (factory == null)
         {
             lock (locker)
             {
                 if (factory == null)
                 {
                     if (Configuration.ObjectExtenderConfig.IsTypeSpecific)
                     {
                         factory = AttributeFactory.Create(new TypeSpecificAttributeMap(() => new GlobalAttributeMap()));
                     }
                     else
                     {
                         factory = AttributeFactory.CreateGlobal();
                     }
                 }
             }
         }
     }
 }
 public void Init()
 {
     factory = AttributeFactory.Create(map);
 }