Esempio n. 1
0
        internal static void Register(IEnumerable <Assembly> assemblies, IEnumerable <ActorInterfaceMapping> mappings)
        {
            var unregistered = new List <ActorInterfaceMapping>();

            foreach (var each in mappings)
            {
                var existing = names.Find(each.TypeName);
                if (existing == null)
                {
                    unregistered.Add(each);
                    continue;
                }

                if (existing.Mapping != each)
                {
                    throw new DuplicateActorTypeException(existing.Mapping, each);
                }
            }

            using (Trace.Execution("Generation of actor interface assemblies"))
            {
                var generated = ActorInterfaceDeclaration.Generate(assemblies, unregistered);

                foreach (var each in generated)
                {
                    names.Add(each.Name, each);
                }
            }
        }
Esempio n. 2
0
        internal static void Register(IEnumerable <Assembly> assemblies, IEnumerable <ActorInterfaceMapping> mappings)
        {
            var generated = ActorInterfaceDeclaration.Generate(assemblies, mappings);

            foreach (var @interface in generated)
            {
                Register(@interface);
            }
        }
Esempio n. 3
0
        static string Name(Type type)
        {
            type = CustomInterface(type) ?? type;

            var customAttribute = type
                                  .GetCustomAttributes(typeof(ActorTypeAttribute), false)
                                  .Cast <ActorTypeAttribute>()
                                  .SingleOrDefault();

            if (customAttribute == null)
            {
                return(type.FullName);
            }

            var name = customAttribute.Name;

            ActorInterfaceDeclaration.CheckValidIdentifier(name);

            return(name);
        }