예제 #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="profile"></param>
        /// <returns></returns>
        public bool Load(string name, out IRoleProfile profile)
        {
            profile = null;
            Type[] matchingTypes;

            if (!TypeDiscovery.Discover<IRoleProfile>(out matchingTypes))
                return false;

            var profileTypeName = (name.EndsWith("Profile")) ? name : name + "Profile";
            var profileType = matchingTypes.First(candidateType => string.Compare(candidateType.Name, profileTypeName) == 0);
            profile = (IRoleProfile) Activator.CreateInstance(profileType);
            return (profile != null);
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="name"></param>
        /// <param name="profile"></param>
        /// <returns></returns>
        public bool Load(string name, out IRoleProfile profile)
        {
            profile = null;
            Type[] matchingTypes;

            if (!TypeDiscovery.Discover <IRoleProfile>(out matchingTypes))
            {
                return(false);
            }

            var profileTypeName = (name.EndsWith("Profile")) ? name : name + "Profile";
            var profileType     = matchingTypes.First(candidateType => string.Compare(candidateType.Name, profileTypeName) == 0);

            profile = (IRoleProfile)Activator.CreateInstance(profileType);
            return(profile != null);
        }
예제 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="name"></param>
 /// <param name="profile"></param>
 /// <returns></returns>
 public static bool Find(string name, out IRoleProfile profile)
 {
     return(new ProfileLoader().Load(name, out profile));
 }
예제 #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="name"></param>
 /// <param name="profile"></param>
 /// <returns></returns>
 public static bool Find(string name, out IRoleProfile profile)
 {
     return new ProfileLoader().Load(name, out profile);
 }