public override int GetHashCode()
 {
     unchecked
     {
         return(("UserDefinedClass".GetHashCode() * 397) ^ DomPath.GetHashCode());
     }
 }
示例#2
0
 public Property(DomPath domPath, bool isNonEmpty, IFactory factory)
 {
     HasHadNonEmptyValue |= isNonEmpty;
     _defaultPropertyDefinitionSet = new Lazy<PropertyDefinitionSet>(CreateDefaultPropertyDefinitionSet);
     _domPath = domPath;
     _factory = factory;
 }
示例#3
0
 public Property(DomPath domPath, bool isNonEmpty, IFactory factory)
 {
     HasHadNonEmptyValue          |= isNonEmpty;
     _defaultPropertyDefinitionSet = new Lazy <PropertyDefinitionSet>(CreateDefaultPropertyDefinitionSet);
     _domPath = domPath;
     _factory = factory;
 }
        public override bool Equals(object other)
        {
            var otherUserDefinedClass = other as UserDefinedClass;

            if (otherUserDefinedClass == null)
            {
                return(false);
            }

            return(DomPath.Equals(otherUserDefinedClass.DomPath));
        }
示例#5
0
        public DomPath GetDomPath(IFactory factory)
        {
            var split = DomPath.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);

            var fullPath      = split[0];
            var typeNameDepth = int.Parse(split[1]);

            var domPath = factory.GetOrCreateDomPath(fullPath, typeNameDepth);

            return(domPath);
        }
示例#6
0
        public UserDefinedClass GetOrAdd(DomPath path, out bool isNew)
        {
            var isNewClass = false;
            var @class     = _classes.GetOrAdd(
                path,
                x =>
            {
                isNewClass = true;
                return(new UserDefinedClass(x));
            });

            isNew = isNewClass;
            return(@class);
        }
示例#7
0
        public DomPath GetOrCreateDomPath(string fullPath, int typeNameDepth)
        {
            if (domPaths.ContainsKey(fullPath))
            {
                return(domPaths[fullPath]);
            }

            var domPath = new DomPath(fullPath, typeNameDepth);

            if (stuff.Contains(domPath.TypeName.Raw))
            {
                throw new InvalidOperationException("Invalid metadata: more than one user defined class with identical type names.");
            }

            stuff.Add(domPath.TypeName.Raw);
            domPaths.Add(fullPath, domPath);
            return(domPath);
        }
示例#8
0
        public Property ToProperty(IRepository repository, IFactory factory)
        {
            var split    = DomPath.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
            var domPath  = factory.GetOrCreateDomPath(split[0], int.Parse(split[1]));
            var property = factory.CreateProperty(domPath, HasHadNonEmptyValue);

            property.CustomName = CustomName;

            property.InitializeDefaultPropertyDefinitionSet(
                propertyDefinitions =>
                propertyDefinitions.Append(DefaultPropertyDefinitionSet.PropertyDefinitions.Select(x => x.ToPropertyDefinition(repository, factory))));

            foreach (var proxySet in ExtraPropertyDefinitionSets)
            {
                var set = proxySet.ToPropertyDefinitionSet(repository, factory);
                property.AddOrUpdateExtraPropertyDefinitionSet(set);
            }

            return(property);
        }
示例#9
0
        public DomPath GetOrCreateDomPath(string fullPath)
        {
            if (domPaths.ContainsKey(fullPath))
            {
                return(domPaths[fullPath]);
            }

            for (int i = 0;; i++)
            {
                var domPath = new DomPath(fullPath, i);
                if (!stuff.Contains(domPath.TypeName.Raw))
                {
                    stuff.Add(domPath.TypeName.Raw);
                    domPaths.Add(fullPath, domPath);
                    return(domPath);
                }
            }

            // If there is one that exists with the given fullPath, return it.
            // Start with a depth of zero.
            //     If there is not one that exists at the current depth, create and return one at that depth
            //     Increment depth
        }
示例#10
0
 public Property CreateProperty(DomPath domPath, bool isNonEmpty)
 {
     return(new Property(domPath, isNonEmpty, this));
 }
示例#11
0
 protected bool Equals(DomPath other)
 {
     return(_hashCode == other._hashCode);
 }
示例#12
0
 public UserDefinedClass GetOrAdd(DomPath path)
 {
     return(_classes.GetOrAdd(
                path,
                x => new UserDefinedClass(x)));
 }
示例#13
0
 public UserDefinedClass(DomPath domPath)
 {
     _domPath = domPath;
     _order = _orderSeed++;
 }
示例#14
0
 public UserDefinedClass(DomPath domPath)
 {
     _domPath = domPath;
     _order   = _orderSeed++;
 }
示例#15
0
        public DomPath GetOrCreateDomPath(string fullPath)
        {
            if (domPaths.ContainsKey(fullPath))
            {
                return domPaths[fullPath];
            }

            for (int i = 0;; i++)
            {
                var domPath = new DomPath(fullPath, i);
                if (!stuff.Contains(domPath.TypeName.Raw))
                {
                    stuff.Add(domPath.TypeName.Raw);
                    domPaths.Add(fullPath, domPath);
                    return domPath;
                }
            }

            // If there is one that exists with the given fullPath, return it.
            // Start with a depth of zero.
            //     If there is not one that exists at the current depth, create and return one at that depth
            //     Increment depth
        }
示例#16
0
        public DomPath GetOrCreateDomPath(string fullPath, int typeNameDepth)
        {
            if (domPaths.ContainsKey(fullPath))
            {
                return domPaths[fullPath];
            }

            var domPath = new DomPath(fullPath, typeNameDepth);
            if (stuff.Contains(domPath.TypeName.Raw))
            {
                throw new InvalidOperationException("Invalid metadata: more than one user defined class with identical type names.");
            }

            stuff.Add(domPath.TypeName.Raw);
            domPaths.Add(fullPath, domPath);
            return domPath;
        }
示例#17
0
 public Property CreateProperty(DomPath domPath, bool isNonEmpty)
 {
     return new Property(domPath, isNonEmpty, this);
 }
示例#18
0
 public UserDefinedClass GetOrAdd(DomPath path)
 {
     return _classes.GetOrAdd(
         path,
         x => new UserDefinedClass(x));
 }
示例#19
0
 public UserDefinedClass GetOrAdd(DomPath path, out bool isNew)
 {
     var isNewClass = false;
     var @class = _classes.GetOrAdd(
         path,
         x =>
         {
             isNewClass = true;
             return new UserDefinedClass(x);
         });
     isNew = isNewClass;
     return @class;
 }
示例#20
0
 protected bool Equals(DomPath other)
 {
     return _hashCode == other._hashCode;
 }