Пример #1
0
        private void AddTypeLine(IMapping mapping)
        {
            Type type = mapping.GetType();

            this.EndLine();
            this.AddTypeInformation();

            this.aResult.Append(ToStringVisitor.aReNumberGenericArguments.Replace(type.Name, ""));
            if (type.IsGenericType)
            {
                this.aResult.Append("<");

                bool first = true;
                foreach (var argument in type.GetGenericArguments())
                {
                    if (!first)
                    {
                        this.aResult.Append(", ");
                    }
                    first = false;

                    this.aResult.Append(argument.Name);
                }

                this.aResult.Append(">");
            }
        }
Пример #2
0
        public void RegisterMapping(IMapping mapping)
        {
            IDictionary <Type, IMapping> mappingTypes;

            if (!_mappings.TryGetValue(mapping.Type, out mappingTypes))
            {
                mappingTypes            = new Dictionary <Type, IMapping>();
                _mappings[mapping.Type] = mappingTypes;
            }

            var mappingType = mapping is ITableViewMapping
                ? typeof(ITableViewMapping)
                : mapping.GetType();


            IMapping checkMapping;

            if (mappingTypes.TryGetValue(mappingType, out checkMapping))
            {
                throw new ConfigurationException("Mapping of type '{0}' for '{1} type is already registered for '{2}' type",
                                                 mappingType.FullName, mapping.Type, checkMapping.Type);
            }

            mappingTypes[mappingType] = mapping;
        }
Пример #3
0
        private bool CheckRecursivelyProcessed(IMapping mapping)
        {
            Type type = mapping.GetType();

            if (this.aProcessed.Contains(type))
            {
                this.aLevel++;
                this.EndLine();
                this.aResult.Append("...");
                this.aLevel--;

                return(true);
            }

            this.aProcessed.Add(type);

            return(false);
        }