示例#1
0
        internal static IObjectDefinition Define <T>()
        {
            var stub     = GetObjectDefStubFromType(typeof(T));
            var assembly = Assembly.GetAssembly(typeof(T));

            var objDefs = GetAllObjectDefHeaders(assembly);

            return(ObjDefHeader.ToObjectDefinition(objDefs[stub.Name]));
        }
示例#2
0
        public static IMetadata ReflectMetadata(Dictionary <string, ObjDefHeader> objDefs)
        {
            var actions = objDefs.Values
                          .SelectMany(od => od.Actions)
                          .ToLookup(kv => kv.Key, kv => kv.Value)
                          .ToDictionary(k => k.Key, k => k.Aggregate(MergeActions) as IActionDefinition);

            var objects = objDefs.ToDictionary(kv => kv.Key, kv => ObjDefHeader.ToObjectDefinition(kv.Value));

            return(new Metadata(new ReadOnlyDictionary <string, IActionDefinition>(actions), new ReadOnlyDictionary <string, IObjectDefinition>(objects)));
        }
示例#3
0
        public static IMetadata ReflectMetadata(Type t)
        {
            var assembly = Assembly.GetAssembly(t);

            var objDefs = GetAllObjectDefHeaders(assembly);
            // Need to separate the ObjDefHead from Full ObjDef

            var actions = objDefs.Values
                          .SelectMany(od => od.Actions)
                          .ToLookup(kv => kv.Key, kv => kv.Value)
                          .ToDictionary(k => k.Key, k => k.Aggregate(MergeActions) as IActionDefinition);

            var objects = objDefs.ToDictionary(kv => kv.Key, kv => ObjDefHeader.ToObjectDefinition(kv.Value));

            return(new Metadata(new ReadOnlyDictionary <string, IActionDefinition>(actions), new ReadOnlyDictionary <string, IObjectDefinition>(objects)));
        }