예제 #1
0
        /// <summary>
        ///     Export all services classes.
        /// </summary>
        protected virtual void ExportServices()
        {
            Type[] types = GetType().Assembly.GetTypes();
            foreach (Type type in types)
            {
                // Register Profile for AutoMapper
                this.RegisterProfileForAutoMapper(type);

                if (type.IsAbstract || (!ServiceType.IsAssignableFrom(type)))
                {
                    continue;
                }

                string infName = "I" + type.Name;
                Type   infType = type.GetInterfaces().FirstOrDefault(t => t.Name == infName);

                if (infType == null)
                {
                    continue;
                }

                this.Add(ExportEntry.Singleton(infType, type));
            }
        }