コード例 #1
0
ファイル: TestBoKey.cs プロジェクト: SaberZA/habanero
        public void TestHasAutoIncrementingProperty_TwoProps_True()
        {
            //---------------Set up test pack-------------------
            PropDef propDef1 = new PropDef("PropName1", typeof(string), PropReadWriteRule.ReadWrite, null);
            PropDef propDef2 = new PropDef("PropName2", typeof(string), PropReadWriteRule.ReadWrite, null);

            propDef2.AutoIncrementing = true;
            BOPropCol propCol = new BOPropCol();

            propCol.Add(propDef1.CreateBOProp(false));
            propCol.Add(propDef2.CreateBOProp(false));
            KeyDef keyDef = new KeyDef();

            keyDef.Add(propDef1);
            keyDef.Add(propDef2);
            IBOKey boKey = keyDef.CreateBOKey(propCol);

            //---------------Assert PreConditions---------------

            //---------------Execute Test ----------------------
            bool hasAutoIncrementingProperty = boKey.HasAutoIncrementingProperty;

            //---------------Test Result -----------------------

            Assert.IsTrue(hasAutoIncrementingProperty);
            //---------------Tear Down -------------------------
        }
コード例 #2
0
        private static ClassDef CreateClassDef()
        {
            PropDefCol lPropDefCol = CreateBOPropDef();

            KeyDef lKeyDef = new KeyDef();

            lKeyDef.IgnoreIfNull = true;
            lKeyDef.Add(lPropDefCol["PK2Prop1"]);
            lKeyDef.Add(lPropDefCol["PK2Prop2"]);
            KeyDefCol keysCol = new KeyDefCol();

            keysCol.Add(lKeyDef);

            lKeyDef = new KeyDef();
            lKeyDef.IgnoreIfNull = false;

            lKeyDef.Add(lPropDefCol["PK3Prop"]);
            keysCol.Add(lKeyDef);

            PrimaryKeyDef primaryKey = new PrimaryKeyDef();

            primaryKey.IsGuidObjectID = true;
            primaryKey.Add(lPropDefCol["ContactPersonID"]);


            //Releationships
            RelationshipDefCol relDefs = CreateRelationshipDefCol(lPropDefCol);

            ClassDef lClassDef = new ClassDef(typeof(ContactPerson), primaryKey, "contact_person", lPropDefCol, keysCol, relDefs);

            ClassDef.ClassDefs.Add(lClassDef);
            return(lClassDef);
        }
コード例 #3
0
ファイル: TestBoKey.cs プロジェクト: SaberZA/habanero
        public void Setup()
        {
            ClassDef.ClassDefs.Clear();
            _boPropCol1 = new BOPropCol();
            _keyDef1    = new KeyDef();
            _boPropCol2 = new BOPropCol();
            _keyDef2    = new KeyDef();

            //Props for KeyDef 1
            PropDef lPropDef = new PropDef("PropName", typeof(string), PropReadWriteRule.ReadWrite, null);

            _boPropCol1.Add(lPropDef.CreateBOProp(false));
            _keyDef1.Add(lPropDef);

            lPropDef = new PropDef("PropName1", typeof(string), PropReadWriteRule.ReadWrite, null);
            _boPropCol1.Add(lPropDef.CreateBOProp(false));
            _keyDef1.Add(lPropDef);

            //Props for KeyDef 2
            lPropDef = new PropDef("PropName1", typeof(string), PropReadWriteRule.ReadWrite, null);
            _boPropCol2.Add(lPropDef.CreateBOProp(false));
            _keyDef2.Add(lPropDef);

            lPropDef = new PropDef("PropName", typeof(string), PropReadWriteRule.ReadWrite, null);
            _boPropCol2.Add(lPropDef.CreateBOProp(false));
            _keyDef2.Add(lPropDef);
        }
コード例 #4
0
        public void TestThisIndexer()
        {
            KeyDef             keyDef = new KeyDef("mykey");
            KeyDefColInheritor col    = new KeyDefColInheritor();

            col.Add(keyDef);
            Assert.AreEqual(keyDef, col.GetThis("mykey"));
        }
コード例 #5
0
        public void init()
        {
            mKeyDef = new KeyDef();
            mKeyDef.IgnoreIfNull = true;
            PropDef lPropDef = new PropDef("PropName", typeof(string), PropReadWriteRule.ReadOnly, null);

            mKeyDef.Add(lPropDef);
        }
コード例 #6
0
        public void TestContainsKeyName()
        {
            KeyDef    keyDef = new KeyDef("mykey");
            KeyDefCol col    = new KeyDefCol();

            Assert.IsFalse(col.Contains("mykey"));
            col.Add(keyDef);
            Assert.IsTrue(col.Contains("mykey"));
        }
コード例 #7
0
        public void TestIsValid()
        {
            PropDef propDef = new PropDef("prop", typeof(String), PropReadWriteRule.ReadWrite, null);
            KeyDef  keyDef  = new KeyDef();

            Assert.IsFalse(keyDef.IsValid());

            keyDef.Add(propDef);
            Assert.IsTrue(keyDef.IsValid());
        }
コード例 #8
0
        public IKeyDef Build(IPropDefCol propDefCol)
        {
            var keyDef = new KeyDef(_keyName);

            foreach (var propName in _propNames)
            {
                var propDef = propDefCol[propName];
                keyDef.Add(propDef);
            }
            return(keyDef);
        }
コード例 #9
0
        public void TestRemove()
        {
            KeyDef             keyDef = new KeyDef();
            KeyDefColInheritor col    = new KeyDefColInheritor();

            col.CallRemove(keyDef);
            col.Add(keyDef);
            Assert.AreEqual(1, col.Count);
            col.CallRemove(keyDef);
            Assert.AreEqual(0, col.Count);
        }
コード例 #10
0
 // ReSharper disable once InconsistentNaming
 public static void Postfix(KeyDef __instance)
 {
     try
     {
         __instance.mActionFlags = new bool[1000];
     }
     catch (Exception e)
     {
         Common.Logger.LogOnce("KeyDef_Constructor.Postfix failed", e);
     }
 }
コード例 #11
0
        public void TestKeyName_BuildFromProps_WhenBlank()
        {
            //-------------Setup Test Pack ------------------
            PropDef propDef1 = new PropDef("prop1", typeof(String), PropReadWriteRule.ReadWrite, null);
            PropDef propDef2 = new PropDef("prop2", typeof(String), PropReadWriteRule.ReadWrite, null);
            KeyDef  keyDef   = new KeyDef("");

            //-------------Test Pre-conditions --------------
            Assert.AreEqual("", keyDef.KeyName);
            //-------------Execute test ---------------------
            keyDef.Add(propDef1);
            keyDef.Add(propDef2);
            //-------------Test Result ----------------------
            Assert.AreEqual("prop1_prop2", keyDef.KeyName);
        }
コード例 #12
0
ファイル: TestBoKey.cs プロジェクト: SaberZA/habanero
        private static IBOKey CreateBOKeyGuid()
        {
            PropDef propDef1 = new PropDef("PropName1", typeof(Guid), PropReadWriteRule.ReadWrite, null)
            {
                ClassDef = ContactPersonTestBO.LoadDefaultClassDef()
            };
            BOPropCol propCol = new BOPropCol();

            propCol.Add(propDef1.CreateBOProp(false));
            KeyDef keyDef = new KeyDef {
                propDef1
            };

            return(keyDef.CreateBOKey(propCol));
        }
コード例 #13
0
            /// <summary>
            /// Adds new key to the named index.
            /// </summary>
            /// <param name="navigator">XPathNavigator over XML document to be indexed</param>
            /// <param name="indexName">Index name</param>
            /// <param name="key">Key definition</param>
            public void AddKey(XPathNavigator navigator, string indexName, KeyDef key)
            {
                indexed = false;
                nav     = navigator;
                //Named indexes are stored in a hashtable.
                if (indexes == null)
                {
                    indexes = new Dictionary <string, XPathNavigatorIndex>();
                }

                if (!indexes.TryGetValue(indexName, out XPathNavigatorIndex index))
                {
                    index = new XPathNavigatorIndex();
                    indexes.Add(indexName, index);
                }
                index.AddKey(key);
            }
コード例 #14
0
        public static ClassDef CreateClassDefWithShapeRelationship()
        {
            PropDefCol lPropDefCol = CreateBOPropDef();

            KeyDef lKeyDef = new KeyDef();

            lKeyDef.IgnoreIfNull = true;
            lKeyDef.Add(lPropDefCol["PK2Prop1"]);
            lKeyDef.Add(lPropDefCol["PK2Prop2"]);
            KeyDefCol keysCol = new KeyDefCol();

            keysCol.Add(lKeyDef);

            lKeyDef = new KeyDef();
            lKeyDef.IgnoreIfNull = false;

            lKeyDef.Add(lPropDefCol["PK3Prop"]);
            keysCol.Add(lKeyDef);

            PrimaryKeyDef primaryKey = new PrimaryKeyDef();

            primaryKey.IsGuidObjectID = true;
            primaryKey.Add(lPropDefCol["ContactPersonID"]);


            //Releationships
            RelationshipDefCol relDefs = new RelationshipDefCol();

            RelKeyDef  relKeyDef   = new RelKeyDef();
            IPropDef   propDef     = lPropDefCol["ContactPersonID"];
            RelPropDef lRelPropDef = new RelPropDef(propDef, "OwnerId");

            relKeyDef.Add(lRelPropDef);

            RelationshipDef relDef = new MultipleRelationshipDef("Shapes", typeof(Shape),
                                                                 relKeyDef, false, "",
                                                                 DeleteParentAction.DereferenceRelated);

            //relDefCol.Add(relDef1);
            relDefs.Add(relDef);

            ClassDef lClassDef = new ClassDef(typeof(ContactPerson), primaryKey, "contact_person", lPropDefCol, keysCol, relDefs);

            ClassDef.ClassDefs.Add(lClassDef);
            return(lClassDef);
        }
コード例 #15
0
ファイル: RulesConverter.cs プロジェクト: tsingh2k15/tweek
        public (string, string, string) Convert(string commitId, ICollection <string> files, Func <string, string> readFn)
        {
            var result = files.ToSeq()
                         .Where(x => manifestRegex.IsMatch(x))
                         .Select(x =>
            {
                try
                {
                    return(JsonConvert.DeserializeObject <Manifest>(readFn(x)));
                }
                catch (Exception ex)
                {
                    ex.Data["key"] = x;
                    throw;
                }
            })
                         .Select(manifest =>
            {
                var keyDef = new KeyDef
                {
                    Format       = manifest.Implementation.Format ?? manifest.Implementation.Type,
                    Dependencies = manifest.GetDependencies()
                };

                switch (manifest.Implementation.Type)
                {
                case "file":
                    keyDef.Payload =
                        readFn(manifest.GetFileImplementionPath());
                    break;

                case "const":
                    keyDef.Payload = JsonConvert.SerializeObject(manifest.Implementation.Value);
                    break;

                case "alias":
                    keyDef.Payload = manifest.Implementation.Key;
                    break;
                }
                return(keyPath: manifest.KeyPath, keyDef: keyDef);
            })
                         .Distinct(x => x.keyPath.ToLower())
                         .ToDictionary(x => x.keyPath, x => x.keyDef);

            return(commitId, JsonConvert.SerializeObject(result), @"application/json");
        }
コード例 #16
0
        public void TestAddNullException()
        {
            //---------------Set up test pack-------------------
            KeyDef keyDef = new KeyDef();

            //---------------Execute Test ----------------------
            try
            {
                keyDef.Add(null);
                Assert.Fail("Expected to throw an HabaneroArgumentException");
            }
            //---------------Test Result -----------------------
            catch (HabaneroArgumentException ex)
            {
                StringAssert.Contains("You cannot add a null prop def to a classdef", ex.Message);
            }
        }
コード例 #17
0
        public void TestThisInvalidPropertyNameException()
        {
            //---------------Set up test pack-------------------
            KeyDef keyDef = new KeyDef();

            //---------------Execute Test ----------------------
            try
            {
                IPropDef propDef = keyDef["wrongprop"];
                Assert.Fail("Expected to throw an InvalidPropertyNameException");
            }
            //---------------Test Result -----------------------
            catch (InvalidPropertyNameException ex)
            {
                StringAssert.Contains("no property with the name 'wrongprop' exists in the collection of properties", ex.Message);
            }
        }
コード例 #18
0
 private void GenerateActionFlagTable()
 {
     mKeyDefLookup.Clear();
     foreach (KInputBinding mBinding in mBindings)
     {
         KeyDefEntry key   = new KeyDefEntry(mBinding.mKeyCode, mBinding.mModifier);
         KeyDef      value = null;
         if (!mKeyDefLookup.TryGetValue(key, out value))
         {
             value = new KeyDef(mBinding.mKeyCode, mBinding.mModifier);
             mKeyDefLookup[key] = value;
         }
         value.mActionFlags[(int)mBinding.mAction] = true;
     }
     mKeyDefs = new KeyDef[mKeyDefLookup.Count];
     mKeyDefLookup.Values.CopyTo(mKeyDefs, 0);
 }
コード例 #19
0
        public void TestIndexer_Int()
        {
            //---------------Set up test pack-------------------
            PropDef propDef1 = new PropDef("prop1", typeof(String), PropReadWriteRule.ReadWrite, null);
            PropDef propDef2 = new PropDef("prop2", typeof(String), PropReadWriteRule.ReadWrite, null);
            KeyDef  keyDef   = new KeyDef("bob");

            keyDef.Add(propDef1);
            keyDef.Add(propDef2);
            //-------------Test Pre-conditions --------------
            //-------------Execute test ---------------------
            IPropDef keyDef0 = keyDef[0];
            IPropDef keyDef1 = keyDef[1];

            //------------Test Result ----------------------
            Assert.AreSame(propDef1, keyDef0);
            Assert.AreSame(propDef2, keyDef1);
        }
コード例 #20
0
            /// <summary>
            /// Adds new key to the named index.
            /// </summary>
            /// <param name="nav">XPathNavigator over XML document to be indexed</param>
            /// <param name="indexName">Index name</param>
            /// <param name="key">Key definition</param>
            public void AddKey(XPathNavigator nav, string indexName, KeyDef key)
            {
                this.indexed = false;
                this.nav     = nav;
                //Named indexes are stored in a hashtable.
                if (indexes == null)
                {
                    indexes = new Hashtable();
                }
                XPathNavigatorIndex index = (XPathNavigatorIndex)indexes[indexName];

                if (index == null)
                {
                    index = new XPathNavigatorIndex();
                    indexes.Add(indexName, index);
                }
                index.AddKey(key);
            }
コード例 #21
0
ファイル: TestBoKey.cs プロジェクト: SaberZA/habanero
        public void TestUpdatedEvent()
        {
            PropDef propDef1 = new PropDef("PropName1", typeof(string), PropReadWriteRule.ReadWrite, null);
            PropDef propDef2 = new PropDef("PropName2", typeof(string), PropReadWriteRule.ReadWrite, null);

            BOPropCol propCol = new BOPropCol();

            propCol.Add(propDef1.CreateBOProp(false));
            propCol.Add(propDef2.CreateBOProp(false));

            KeyDef keyDef = new KeyDef {
                propDef1, propDef2
            };
            IBOKey boKey = keyDef.CreateBOKey(propCol);

            boKey.Updated += UpdatedEventHandler;
            propCol["PropName1"].Value = "new value";
            Assert.IsTrue(_updatedEventHandled);
        }
コード例 #22
0
 public void QueueButtonEvent(KeyDef key_def, bool is_down)
 {
     if (KInputManager.isFocused)
     {
         bool[] mActionFlags = key_def.mActionFlags;
         key_def.mIsDown = is_down;
         InputEventType event_type = (!is_down) ? InputEventType.KeyUp : InputEventType.KeyDown;
         for (int i = 0; i < mActionFlags.Length; i++)
         {
             if (mActionFlags[i])
             {
                 mActionState[i] = is_down;
             }
         }
         KButtonEvent item = new KButtonEvent(this, event_type, mActionFlags);
         mEvents.Add(item);
         KInputManager.SetUserActive();
     }
 }
コード例 #23
0
ファイル: TestBoKey.cs プロジェクト: SaberZA/habanero
        public void TestIntegerIndexer()
        {
            PropDef propDef1 = new PropDef("PropName1", typeof(string), PropReadWriteRule.ReadOnly, null);
            PropDef propDef2 = new PropDef("PropName2", typeof(string), PropReadWriteRule.ReadOnly, null);

            BOPropCol propCol = new BOPropCol();

            propCol.Add(propDef1.CreateBOProp(false));
            propCol.Add(propDef2.CreateBOProp(false));

            KeyDef keyDef = new KeyDef();

            keyDef.Add(propDef1);
            keyDef.Add(propDef2);
            IBOKey boKey = keyDef.CreateBOKey(propCol);

            Assert.AreEqual(propCol["PropName1"], boKey[0]);
            Assert.AreEqual(propCol["PropName2"], boKey[1]);
        }
コード例 #24
0
        public void TestAddDuplicationException()
        {
            //---------------Set up test pack-------------------
            KeyDef    keyDef = new KeyDef();
            KeyDefCol col    = new KeyDefCol();

            col.Add(keyDef);
            //---------------Execute Test ----------------------
            try
            {
                col.Add(keyDef);
                Assert.Fail("Expected to throw an ArgumentException");
            }
            //---------------Test Result -----------------------
            catch (ArgumentException ex)
            {
                StringAssert.Contains("already exists", ex.Message);
            }
        }
コード例 #25
0
ファイル: TestBoKey.cs プロジェクト: SaberZA/habanero
        public void TestEquality()
        {
            BOKey boKey = (BOKey)_keyDef1.CreateBOKey(_boPropCol1);

            // Test when property count is different
            KeyDef keyDef   = new KeyDef();
            BOKey  otherKey = new BOKey(keyDef);

            Assert.IsFalse(boKey == otherKey);

            // Same property count, but different prop names
            PropDef   propDef1 = new PropDef("PropName5", typeof(string), PropReadWriteRule.ReadOnly, null);
            PropDef   propDef2 = new PropDef("PropName6", typeof(string), PropReadWriteRule.ReadOnly, null);
            BOPropCol propCol  = new BOPropCol();

            propCol.Add(propDef1.CreateBOProp(false));
            propCol.Add(propDef2.CreateBOProp(false));
            keyDef.Add(propDef1);
            keyDef.Add(propDef2);
            otherKey = (BOKey)keyDef.CreateBOKey(propCol);
            Assert.IsFalse(boKey == otherKey);

            // Same props but different values (with one null)
            otherKey = (BOKey)_keyDef1.CreateBOKey(_boPropCol2);
            otherKey["PropName"].Value = "blah";
            Assert.IsFalse(boKey == otherKey);

            // Same props but different values (neither are null)
            otherKey = (BOKey)_keyDef1.CreateBOKey(_boPropCol2);
            boKey["PropName"].Value = "diblah";
            Assert.IsFalse(boKey == otherKey);
            Assert.IsFalse(boKey.Equals(otherKey));

            // False when different type of object
            Assert.IsFalse(boKey.Equals(keyDef));

            // Finally, when they are equal
            boKey["PropName"].Value = "blah";
            Assert.IsTrue(boKey == otherKey);
            Assert.IsTrue(boKey.Equals(otherKey));
        }
コード例 #26
0
        public void TestIndexer_Int_OutOfRange()
        {
            //---------------Set up test pack-------------------
            PropDef propDef1 = new PropDef("prop1", typeof(String), PropReadWriteRule.ReadWrite, null);
            PropDef propDef2 = new PropDef("prop2", typeof(String), PropReadWriteRule.ReadWrite, null);
            KeyDef  keyDef   = new KeyDef("bob");

            keyDef.Add(propDef1);
            keyDef.Add(propDef2);
            //-------------Test Pre-conditions --------------
            //-------------Execute test ---------------------
            try
            {
                IPropDef keyDef0 = keyDef[2];
                Assert.Fail("Expected to throw an ArgumentOutOfRangeException");
            }
            //---------------Test Result -----------------------
            catch (ArgumentOutOfRangeException ex)
            {
                StringAssert.Contains("index out of range", ex.Message);
            }
        }
コード例 #27
0
ファイル: Shape.cs プロジェクト: SaberZA/habanero
        public static ClassDef CreateTestMapperClassDef()
        {
            PropDefCol lPropDefCol = new PropDefCol();
            PropDef    propDef     =
                new PropDef("ShapeName", typeof(String), PropReadWriteRule.ReadWrite, "ShapeName", null);

            lPropDefCol.Add(propDef);
            propDef = new PropDef("ShapeID", typeof(Guid), PropReadWriteRule.WriteOnce, "ShapeID_field", null);
            lPropDefCol.Add(propDef);
            propDef = new PropDef("ShapeValue", typeof(Int32), PropReadWriteRule.ReadWrite, null);
            lPropDefCol.Add(propDef);
            // propDef = new PropDef("MyID", typeof(Guid), PropReadWriteRule.WriteOnce, null);
            // lPropDefCol.Add(propDef);
            PrimaryKeyDef primaryKey = new PrimaryKeyDef();

            primaryKey.IsGuidObjectID = true;
            primaryKey.Add(lPropDefCol["ShapeID"]);
            KeyDefCol keysCol = new KeyDefCol();
            KeyDef    lKeyDef = new KeyDef();

            lKeyDef.Add(lPropDefCol["ShapeName"]);
            keysCol.Add(lKeyDef);
//            RelKeyDef relKeyDef = new RelKeyDef();

            //RelPropDef lRelPropDef = new RelPropDef(propDef, "OwnerID");
            //relKeyDef.Add(lRelPropDef);
            //RelationshipDef relDef = new MultipleRelationshipDef("Owner", typeof (Shape),
            //                                                      relKeyDef, false, "", DeleteParentAction.DereferenceRelated);
            RelationshipDefCol relDefCol = new RelationshipDefCol();
            //relDefCol.Add(relDef);

            ClassDef lClassDef = new ClassDef(typeof(Shape), primaryKey, "Shape_table", lPropDefCol, keysCol, relDefCol);

            ClassDef.ClassDefs.Add(lClassDef);
            return(lClassDef);
        }
コード例 #28
0
        public void TestAddRange()
        {
            //---------------Set up test pack-------------------
            var keyDef1 = new KeyDef("key1");
            var keyDef2 = new KeyDef("key2");
            var keyDef3 = new KeyDef("key3");

            var col = new KeyDefCol {
                keyDef1, keyDef2, keyDef3
            };

            var testCol = new KeyDefCol();

            //---------------Assert Precondition----------------
            Assert.AreEqual(3, col.Count);
            Assert.AreEqual(0, testCol.Count);
            //---------------Execute Test ----------------------
            testCol.AddRange(col);
            //---------------Test Result -----------------------
            Assert.AreEqual(3, testCol.Count);
            Assert.IsTrue(col.Contains("key1"));
            Assert.IsTrue(col.Contains("key2"));
            Assert.IsTrue(col.Contains("key3"));
        }
コード例 #29
0
 // ReSharper disable once InconsistentNaming
 public static void ExitKeyDef(KeyDef __instance)
 {
     __instance.mActionFlags = new bool[1000];
 }
コード例 #30
0
 // ReSharper disable once InconsistentNaming
 public static void KInputControllerMod(KeyDef __instance)
 {
     SetField(__instance, "mActionState", new bool[1000]);
 }
コード例 #31
0
			/// <summary>
			/// Adds new key to the named index.
			/// </summary>
			/// <param name="nav">XPathNavigator over XML document to be indexed</param>
			/// <param name="indexName">Index name</param>
			/// <param name="key">Key definition</param>
			public void AddKey(XPathNavigator nav, string indexName, KeyDef key) 
			{
				this.indexed = false;
				this.nav = nav;
				//Named indexes are stored in a hashtable.
				if (indexes == null)
					indexes = new Hashtable();
				XPathNavigatorIndex index = (XPathNavigatorIndex)indexes[indexName];
				if (index == null) 
				{
					index = new XPathNavigatorIndex(); 
					indexes.Add(indexName, index);
				}       
				index.AddKey(key);
			}
コード例 #32
0
 public virtual void AddKey(string keyName, string match, string use, XsltContext customXsltContext)
 {
     KeyDef key = new KeyDef(nav, match, use, customXsltContext);
     manager.AddKey(nav, keyName, key);
 }
コード例 #33
0
 /// <summary>
 /// Adds named key for use with key() function.
 /// </summary>
 /// <param name="keyName">The name of the key</param>
 /// <param name="match">XPath pattern, defining the nodes to which 
 /// this key is applicable</param>
 /// <param name="use">XPath expression used to determine 
 /// the value of the key for each matching node</param>
 public virtual void AddKey(string keyName, string match, string use)
 {
     KeyDef key = new KeyDef(nav, match, use);
     manager.AddKey(nav, keyName, key);
 }
コード例 #34
0
 /// <summary>
 /// Adds new key to the named index.
 /// </summary>
 /// <param name="nav">XPathNavigator over XML document to be indexed</param>
 /// <param name="indexName">Index name</param>
 /// <param name="key">Key definition</param>
 public void AddKey(XPathNavigator nav, string indexName, KeyDef key)
 {
     this.indexed = false;
     this.nav = nav;
     //Named indexes are stored in a hashtable.
     if (indexes == null)
         indexes = new Dictionary<string, XPathNavigatorIndex>();
     XPathNavigatorIndex index;
     if (!indexes.TryGetValue(indexName, out index))
     {
         index = new XPathNavigatorIndex();
         indexes.Add(indexName, index);
     }
     index.AddKey(key);
 }
コード例 #35
0
 /// <summary>
 /// Adds a key.
 /// </summary>
 /// <param name="key">Key definition</param>
 public void AddKey(KeyDef key)
 {
     keys.Add(key);
 }