Beispiel #1
0
        public static bool ConfigDuplicatesPolicy(XmlElement xmlElem,
                                                  string name, ref DuplicatesPolicy duplicatePolicy, bool compulsory)
        {
            XmlNode xmlNode;

            xmlNode = XMLReader.GetNode(xmlElem, name);
            if (xmlNode == null && compulsory == false)
            {
                return(false);
            }
            else if (xmlNode == null && compulsory == true)
            {
                throw new ConfigNotFoundException(name);
            }

            if (xmlNode.InnerText == "NONE")
            {
                duplicatePolicy = DuplicatesPolicy.NONE;
            }
            else if (xmlNode.InnerText == "SORTED")
            {
                duplicatePolicy = DuplicatesPolicy.SORTED;
            }
            else if (xmlNode.InnerText == "UNSORTED")
            {
                duplicatePolicy = DuplicatesPolicy.UNSORTED;
            }
            else
            {
                throw new InvalidConfigException(name);
            }

            return(true);
        }
Beispiel #2
0
        public static void ConfirmDuplicatesPolicy(
            XmlElement xmlElem, string name,
            DuplicatesPolicy duplicatedPolicy, bool compulsory)
        {
            XmlNode xmlNode;

            xmlNode = XMLReader.GetNode(xmlElem, name);
            if (xmlNode == null && compulsory == true)
            {
                throw new ConfigNotFoundException(name);
            }
            else if (xmlNode != null)
            {
                if (xmlNode.InnerText == "NONE")
                {
                    Assert.AreEqual(duplicatedPolicy, DuplicatesPolicy.NONE);
                }
                else if (xmlNode.InnerText == "SORTED")
                {
                    Assert.AreEqual(duplicatedPolicy, DuplicatesPolicy.SORTED);
                }
                else if (xmlNode.InnerText == "UNSORTED")
                {
                    Assert.AreEqual(duplicatedPolicy, DuplicatesPolicy.UNSORTED);
                }
            }
        }
Beispiel #3
0
 /// <summary>
 /// Instantiate a new HashDatabaseConfig object
 /// </summary>
 public HashDatabaseConfig() {
     Duplicates = DuplicatesPolicy.NONE;
     HashComparison = null;
     fillFactorIsSet = false;
     nelemIsSet = false;
     Creation = CreatePolicy.NEVER;
 }
 /// <summary>
 /// Instantiate a new SecondaryHashDatabaseConfig object
 /// </summary>
 public SecondaryHashDatabaseConfig(
     Database PrimaryDB, SecondaryKeyGenDelegate KeyGenFunc)
     : base(PrimaryDB, KeyGenFunc)
 {
     Duplicates      = DuplicatesPolicy.NONE;
     Compare         = null;
     fillFactorIsSet = false;
     nelemIsSet      = false;
     DbType          = DatabaseType.HASH;
 }
        /// <param name="relationship">Reletionship of key and entity.</param>
        /// <param name="duplicatesPolicy">Duplication policy between current entity and marked secondary key.</param>
        /// <exception cref="InvalidOperationException">relationshid and duplicates policy conflicts with each other.</exception>
        public SecondaryKeyAttribute(Relationship relationship = Relationship.ManyToOne, DuplicatesPolicy duplicatesPolicy = DuplicatesPolicy.UNSORTED)
        {
            Relationship     = relationship;
            DuplicatesPolicy = duplicatesPolicy;

            if (DuplicatesPolicy == DuplicatesPolicy.NONE && relationship != Relationship.OneToOne)
            {
                throw new InvalidOperationException($"{nameof(Relationship)} {relationship} can't be in pair with {nameof(DuplicatesPolicy)} {duplicatesPolicy}");
            }

            //todo: check relationship and duplicatesPolicy for compatibility
        }
Beispiel #6
0
        /// <summary>
        /// Create a new BTreeDatabaseConfig object
        /// </summary>
        public BTreeDatabaseConfig()
        {
            Duplicates         = DuplicatesPolicy.NONE;
            NoReverseSplitting = false;
            UseRecordNumbers   = false;

            BTreeCompare       = null;
            BTreePrefixCompare = null;

            minkeysIsSet = false;

            Creation = CreatePolicy.NEVER;
        }
        /// <summary>
        /// Create a new SecondaryBTreeDatabaseConfig object
        /// </summary>
        public SecondaryBTreeDatabaseConfig(
            Database PrimaryDB, SecondaryKeyGenDelegate KeyGenFunc)
            : base(PrimaryDB, KeyGenFunc)
        {
            Duplicates         = DuplicatesPolicy.NONE;
            NoReverseSplitting = false;
            UseRecordNumbers   = false;

            Compare       = null;
            PrefixCompare = null;

            minkeysIsSet = false;

            DbType = DatabaseType.BTREE;
        }
        /// <summary>
        /// Create a new BTreeDatabaseConfig object
        /// </summary>
        public BTreeDatabaseConfig()
        {
            Duplicates = DuplicatesPolicy.NONE;
            NoReverseSplitting = false;
            UseRecordNumbers = false;

            BTreeCompare = null;
            BTreePrefixCompare = null;

            minkeysIsSet = false;

            Creation = CreatePolicy.NEVER;
        }
 /// <summary>
 /// Instantiate a new HashDatabaseConfig object
 /// </summary>
 public HashDatabaseConfig() {
     blobThresholdIsSet = false;
     Duplicates = DuplicatesPolicy.NONE;
     HashComparison = null;
     fillFactorIsSet = false;
     nelemIsSet = false;
     Creation = CreatePolicy.NEVER;
 }
 /// <summary>
 /// Instantiate a new SecondaryHashDatabaseConfig object
 /// </summary>
 public SecondaryHashDatabaseConfig(
     Database PrimaryDB, SecondaryKeyGenDelegate KeyGenFunc)
     : base(PrimaryDB, KeyGenFunc)
 {
     Duplicates = DuplicatesPolicy.NONE;
     Compare = null;
     fillFactorIsSet = false;
     nelemIsSet = false;
     DbType = DatabaseType.HASH;
 }
Beispiel #11
0
        public static void ConfirmDuplicatesPolicy(
		    XmlElement xmlElem, string name,
		    DuplicatesPolicy duplicatedPolicy, bool compulsory)
        {
            XmlNode xmlNode;
            xmlNode = XMLReader.GetNode(xmlElem, name);
            if (xmlNode == null && compulsory == true)
                throw new ConfigNotFoundException(name);
            else if (xmlNode != null)
            {
                if (xmlNode.InnerText == "NONE")
                    Assert.AreEqual(duplicatedPolicy, DuplicatesPolicy.NONE);
                else if (xmlNode.InnerText == "SORTED")
                    Assert.AreEqual(duplicatedPolicy, DuplicatesPolicy.SORTED);
                else if (xmlNode.InnerText == "UNSORTED")
                    Assert.AreEqual(duplicatedPolicy, DuplicatesPolicy.UNSORTED);
            }
        }
Beispiel #12
0
        public static bool ConfigDuplicatesPolicy(XmlElement xmlElem,
		    string name, ref DuplicatesPolicy duplicatePolicy,bool compulsory)
        {
            XmlNode xmlNode;

            xmlNode = XMLReader.GetNode(xmlElem, name);
            if (xmlNode == null && compulsory == false)
                return false;
            else if (xmlNode == null && compulsory == true)
                throw new ConfigNotFoundException(name);

            if (xmlNode.InnerText == "NONE")
                duplicatePolicy = DuplicatesPolicy.NONE;
            else if (xmlNode.InnerText == "SORTED")
                duplicatePolicy = DuplicatesPolicy.SORTED;
            else if (xmlNode.InnerText == "UNSORTED")
                duplicatePolicy = DuplicatesPolicy.UNSORTED;
            else
                throw new InvalidConfigException(name);

            return true;
        }
        /// <summary>
        /// Create a new SecondaryBTreeDatabaseConfig object
        /// </summary>
        public SecondaryBTreeDatabaseConfig(
            Database PrimaryDB, SecondaryKeyGenDelegate KeyGenFunc)
            : base(PrimaryDB, KeyGenFunc) {
            Duplicates = DuplicatesPolicy.NONE;
            NoReverseSplitting = false;
            UseRecordNumbers = false;

            Compare = null;
            PrefixCompare = null;

            minkeysIsSet = false;

            DbType = DatabaseType.BTREE;
        }
 /// <param name="navigationPropertyPath">Name of navigation property, that navigates to the other entity, from the current.</param>
 /// <param name="foreignEntityName">
 /// Name of the other entity, that is referenced by the current.
 /// Be sure - it's the name of the entity, not the name of class that represents entity.
 /// </param>
 /// <param name="relationship">Reletionship of key and entity.</param>
 /// <param name="duplicatesPolicy">Duplication policy between current entity and marked secondary key.</param>
 public ForeignKeyAttribute(string navigationPropertyPath, string foreignEntityName, Relationship relationship = Relationship.ManyToOne, DuplicatesPolicy duplicatesPolicy = DuplicatesPolicy.UNSORTED)
     : base(relationship, duplicatesPolicy)
 {
     NavigationPropertyPath = navigationPropertyPath;
     ForeignEntityName      = foreignEntityName;
 }