コード例 #1
0
        public void CreateMapping <TSource, TTarget>()
        {
            var key = new MappingKey(typeof(TSource), typeof(TTarget));

            if (Builders.ContainsKey(key))
            {
                throw new MappingAlreadyExistsException("Another mapping already exists with the supplied types");
            }

            var builder = new MappingBuilder <TSource, TTarget>(this);

            builder.CreateDefaultBindings();

            Builders.Add(key, builder);
            BuilderDescriptors.Add(new BuilderDescriptor(typeof(TSource), typeof(TTarget), builder.Dependencies, true));
        }