示例#1
0
        internal EntityMapping GetMapping(Type declaringType, string path)
        {
            var mappingPath = new MappingPath {
                Type = declaringType, Path = path
            };

            if (_items.ContainsKey(mappingPath))
            {
                return(_items[mappingPath]);
            }
            return(null);
        }
示例#2
0
        internal void AddMapping(Type declaringType, EntityMapping mapping)
        {
            if (mapping == null)
            {
                throw new ArgumentNullException("mapping", Properties.Resources.MappingNotSpecified);
            }
            if (mapping.Name == null)
            {
                throw new ArgumentNullException("mapping.Name", Properties.Resources.MappingNotSpecified);
            }

            var path = new MappingPath {
                Type = declaringType, Path = mapping.Name
            };

            if (_items.ContainsKey(path))
            {
                throw new ArgumentException(Properties.Resources.DuplicatePartName, "part");
            }

            _items.Add(path, mapping);
        }