コード例 #1
0
        public static MapperClient Create(params IProfile[] profiles)
        {
            var client = new MapperClient();

            foreach (var profile in profiles)
            {
                client.AddProfile(profile);
            }

            return(client);
        }
コード例 #2
0
        /// <summary>
        /// Create from a list of mapped strings.
        /// Syntax: '[]:Id FooName Child.FooChildName'
        /// </summary>
        /// <param name="mappingStrings"></param>
        /// <returns></returns>
        public static MapperClient Create(params string[] mappingStrings)
        {
            var client = new MapperClient();

            foreach (var item in mappingStrings)
            {
                var splitItem = item.Split(':');

                var props = new List <ProfileProperty>();

                foreach (var propStr in splitItem[1].Split(' '))
                {
                    props.Add(ProfileProperty.Create(propStr));
                }

                var profile = Profile.Create(splitItem[0],
                                             props.ToArray());

                client.AddProfile(profile);
            }

            return(client);
        }