当前位置: 首页>>代码示例>>C#>>正文


C# EntityType.GetKey方法代码示例

本文整理汇总了C#中EntityType.GetKey方法的典型用法代码示例。如果您正苦于以下问题:C# EntityType.GetKey方法的具体用法?C# EntityType.GetKey怎么用?C# EntityType.GetKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EntityType的用法示例。


在下文中一共展示了EntityType.GetKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsRequired_when_dependent_property_nullable

        public void IsRequired_when_dependent_property_nullable()
        {
            var entityType = new EntityType("E");
            entityType.SetKey(entityType.AddProperty("Id", typeof(int)));
            var dependentProp = entityType.AddProperty("P", typeof(int?));

            var foreignKey = new ForeignKey(entityType.GetKey(), new[] { dependentProp });

            Assert.False(foreignKey.IsRequired);
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:10,代码来源:ForeignKeyTest.cs

示例2: It_adds_composite_key

        public void It_adds_composite_key()
        {
            var entityType = new EntityType("John Maynard");
            entityType.AddProperty("PartitionKey", typeof(string));
            entityType.AddProperty("RowKey", typeof(string));

            _convention.Apply(entityType);

            var key = entityType.GetKey();
            Assert.Equal(2, key.Properties.Count);
            Assert.Contains("PartitionKey", key.Properties.Select(p => p.ColumnName()));
            Assert.Contains("RowKey", key.Properties.Select(p => p.ColumnName()));
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:13,代码来源:PartitionAndRowKeyConventionTests.cs

示例3: Can_create_foreign_key

        public void Can_create_foreign_key()
        {
            var entityType = new EntityType("E");
            var dependentProp = entityType.AddProperty("P", typeof(int));
            var principalProp = entityType.AddProperty("Id", typeof(int));
            entityType.SetKey(principalProp);

            var foreignKey
                = new ForeignKey(entityType.GetKey(), new[] { dependentProp })
                    {
                        IsUnique = true,
                    };

            Assert.Same(entityType, foreignKey.ReferencedEntityType);
            Assert.Same(principalProp, foreignKey.ReferencedProperties.Single());
            Assert.Same(dependentProp, foreignKey.Properties.Single());
            Assert.True(foreignKey.IsUnique);
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:18,代码来源:ForeignKeyTest.cs

示例4: BuildModel

        protected override Model BuildModel()
        {
            var model = new Model();

            var entityType1 = new EntityType("SomeEntity");
            model.AddEntityType(entityType1);
            var key1 = entityType1.AddProperty("Id", typeof(int), shadowProperty: true, concurrencyToken: false);
            key1.ValueGenerationOnSave = ValueGenerationOnSave.WhenInserting;
            key1.ValueGenerationOnAdd = ValueGenerationOnAdd.Client;
            entityType1.SetKey(key1);
            entityType1.AddProperty("Name", typeof(string), shadowProperty: true, concurrencyToken: true);

            var entityType2 = new EntityType("SomeDependentEntity");
            model.AddEntityType(entityType2);
            var key2a = entityType2.AddProperty("Id1", typeof(int), shadowProperty: true, concurrencyToken: false);
            var key2b = entityType2.AddProperty("Id2", typeof(string), shadowProperty: true, concurrencyToken: false);
            entityType2.SetKey(key2a, key2b);
            var fk = entityType2.AddProperty("SomeEntityId", typeof(int), shadowProperty: true, concurrencyToken: false);
            entityType2.AddForeignKey(entityType1.GetKey(), new[] { fk });
            var justAProperty = entityType2.AddProperty("JustAProperty", typeof(int), shadowProperty: true, concurrencyToken: false);
            justAProperty.ValueGenerationOnSave = ValueGenerationOnSave.WhenInserting;
            justAProperty.ValueGenerationOnAdd = ValueGenerationOnAdd.Client;

            var entityType3 = new EntityType(typeof(FullNotificationEntity));
            model.AddEntityType(entityType3);
            entityType3.SetKey(entityType3.AddProperty("Id", typeof(int), shadowProperty: true, concurrencyToken: false));
            entityType3.AddProperty("Name", typeof(string), shadowProperty: true, concurrencyToken: true);

            var entityType4 = new EntityType(typeof(ChangedOnlyEntity));
            model.AddEntityType(entityType4);
            entityType4.SetKey(entityType4.AddProperty("Id", typeof(int), shadowProperty: true, concurrencyToken: false));
            entityType4.AddProperty("Name", typeof(string), shadowProperty: true, concurrencyToken: true);

            var entityType5 = new EntityType("SomeMoreDependentEntity");
            model.AddEntityType(entityType5);
            var key5 = entityType5.AddProperty("Id", typeof(int), shadowProperty: true, concurrencyToken: false);
            entityType5.SetKey(key5);
            var fk5a = entityType5.AddProperty("Fk1", typeof(int), shadowProperty: true, concurrencyToken: false);
            var fk5b = entityType5.AddProperty("Fk2", typeof(string), shadowProperty: true, concurrencyToken: false);
            entityType5.AddForeignKey(entityType2.GetKey(), new[] { fk5a, fk5b });

            return model;
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:43,代码来源:ShadowStateEntryTest.cs

示例5: Can_add_and_get_a_key

        public void Can_add_and_get_a_key()
        {
            var entityType = new EntityType(typeof(Customer), new Model());
            var idProperty = entityType.GetOrAddProperty(Customer.IdProperty);
            var nameProperty = entityType.GetOrAddProperty(Customer.NameProperty);

            var key1 = entityType.AddKey(new[] { idProperty, nameProperty });

            Assert.NotNull(key1);
            Assert.Same(key1, entityType.GetOrAddKey(new[] { idProperty, nameProperty }));
            Assert.Same(key1, entityType.Keys.Single());

            var key2 = entityType.GetOrAddKey(idProperty);

            Assert.NotNull(key2);
            Assert.Same(key2, entityType.GetKey(idProperty));
            Assert.Equal(2, entityType.Keys.Count());
            Assert.Contains(key1, entityType.Keys);
            Assert.Contains(key2, entityType.Keys);
        }
开发者ID:thegido,项目名称:EntityFramework,代码行数:20,代码来源:EntityTypeTest.cs

示例6: Diff_finds_dropped_table

        public void Diff_finds_dropped_table()
        {
            var sourceModel = CreateModel();
            var targetModel = CreateModel();

            var principalEntityType = targetModel.GetEntityType("Principal");
            var dependentEntityType = new EntityType("OldDependent");
            dependentEntityType.SetTableName("MyOldTable");
            dependentEntityType.SetSchema("dbo");
            var dependentProperty = dependentEntityType.AddProperty("Id", typeof(int));

            sourceModel.AddEntityType(dependentEntityType);

            dependentProperty.Annotations.Add(new Annotation(
                MetadataExtensions.Annotations.StorageTypeName, "int"));

            dependentEntityType.SetKey(dependentProperty);
            dependentEntityType.GetKey().SetKeyName("MyOldPK");

            var foreignKey = dependentEntityType.AddForeignKey(principalEntityType.GetKey(), dependentProperty);
            foreignKey.SetKeyName("MyOldFK");
            foreignKey.Annotations.Add(new Annotation(
                MetadataExtensions.Annotations.CascadeDelete, "True"));

            var operations = new ModelDiffer(new DatabaseBuilder()).Diff(sourceModel, targetModel);

            Assert.Equal(1, operations.Count);
            Assert.IsType<DropTableOperation>(operations[0]);

            var dropTableOperation = (DropTableOperation)operations[0];

            Assert.Equal("dbo.MyOldTable", dropTableOperation.TableName);
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:33,代码来源:ModelDifferTest.cs

示例7: Diff_finds_created_table

        public void Diff_finds_created_table()
        {
            var sourceModel = CreateModel();
            var targetModel = CreateModel();

            var principalEntityType = targetModel.GetEntityType("Principal");
            var dependentEntityType = new EntityType("NewDependent");
            dependentEntityType.SetTableName("MyNewTable");
            dependentEntityType.SetSchema("dbo");
            var dependentProperty = dependentEntityType.AddProperty("Id", typeof(int));

            targetModel.AddEntityType(dependentEntityType);

            dependentProperty.Annotations.Add(new Annotation(
                MetadataExtensions.Annotations.StorageTypeName, "int"));

            dependentEntityType.SetKey(dependentProperty);
            dependentEntityType.GetKey().SetKeyName("MyNewPK");

            var foreignKey = dependentEntityType.AddForeignKey(principalEntityType.GetKey(), dependentProperty);
            foreignKey.SetKeyName("MyNewFK");
            foreignKey.Annotations.Add(new Annotation(
                MetadataExtensions.Annotations.CascadeDelete, "True"));

            var operations = new ModelDiffer(new DatabaseBuilder()).Diff(sourceModel, targetModel);

            Assert.Equal(2, operations.Count);
            Assert.IsType<CreateTableOperation>(operations[0]);
            Assert.IsType<AddForeignKeyOperation>(operations[1]);

            var createTableOperation = (CreateTableOperation)operations[0];

            Assert.Equal("dbo.MyNewTable", createTableOperation.Table.Name);
            Assert.Equal(1, createTableOperation.Table.Columns.Count);
            Assert.Equal("Id", createTableOperation.Table.Columns[0].Name);
            Assert.Equal(typeof(int), createTableOperation.Table.Columns[0].ClrType);
            Assert.NotNull(createTableOperation.Table.PrimaryKey);
            Assert.Equal("MyNewPK", createTableOperation.Table.PrimaryKey.Name);
            Assert.Equal(1, createTableOperation.Table.ForeignKeys.Count);
            Assert.Equal("MyNewFK", createTableOperation.Table.ForeignKeys[0].Name);
            Assert.True(createTableOperation.Table.ForeignKeys[0].CascadeDelete);

            var addForeignKeyOperation = (AddForeignKeyOperation)operations[1];

            Assert.Equal("MyNewFK", addForeignKeyOperation.ForeignKeyName);
            Assert.Equal("dbo.MyNewTable", addForeignKeyOperation.TableName);
            Assert.Equal("dbo.MyTable1", addForeignKeyOperation.ReferencedTableName);
            Assert.Equal(new[] { "Id" }, addForeignKeyOperation.ColumnNames);
            Assert.Equal(new[] { "Id" }, addForeignKeyOperation.ReferencedColumnNames);
            Assert.True(addForeignKeyOperation.CascadeDelete);
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:51,代码来源:ModelDifferTest.cs

示例8: BuildModel

        private static IModel BuildModel()
        {
            var model = new Model();
            var builder = new ModelBuilder(model);

            builder.Annotation("ModelAnnotation1", "ModelValue1");
            builder.Annotation("ModelAnnotation2", "ModelValue2");

            var entityType1 = new EntityType(typeof(KoolEntity1));
            var property = entityType1.AddProperty("Id1", typeof(int));
            entityType1.SetKey(property);
            entityType1.AddProperty("Id2", typeof(Guid));
            entityType1.AddProperty("KoolEntity2Id", typeof(int));
            model.AddEntityType(entityType1);

            var entityType2 = new EntityType(typeof(KoolEntity2));
            entityType2.AddProperty("KoolEntity1Id1", typeof(int));
            entityType2.AddProperty("KoolEntity1Id2", typeof(Guid));
            entityType2.AddProperty("KoolEntity3Id", typeof(int));
            model.AddEntityType(entityType2);

            var entityType3 = new EntityType(typeof(KoolEntity3));
            entityType3.AddProperty("KoolEntity4Id", typeof(int));
            model.AddEntityType(entityType3);

            var entityType4 = new EntityType(typeof(KoolEntity4));
            model.AddEntityType(entityType4);

            var entityType5 = new EntityType(typeof(KoolEntity5));
            model.AddEntityType(entityType5);

            var entityType6 = new EntityType(typeof(KoolEntity6));
            entityType6.AddProperty("Kool5Id", typeof(int));
            model.AddEntityType(entityType6);

            for (var i = 7; i <= 20; i++)
            {
                var type = Type.GetType("Microsoft.Data.Entity.FunctionalTests.Metadata.KoolEntity" + i);

                Assert.NotNull(type);

                model.AddEntityType(new EntityType(type));
            }

            for (var i = 2; i <= 20; i++)
            {
                var type = Type.GetType("Microsoft.Data.Entity.FunctionalTests.Metadata.KoolEntity" + i);

                var entityType = model.GetEntityType(type);
                var id = entityType.AddProperty(entityType.Type.GetProperty("Id"));
                entityType.SetKey(id);
            }

            for (var i = 1; i <= 20; i++)
            {
                var type = Type.GetType("Microsoft.Data.Entity.FunctionalTests.Metadata.KoolEntity" + i);

                var entityType = model.GetEntityType(type);

                entityType.Annotations.Add(new Annotation("Annotation1", "Value1"));
                entityType.Annotations.Add(new Annotation("Annotation2", "Value2"));

                var foo = entityType.AddProperty(entityType.Type.GetProperty("Foo" + i));

                foo.Annotations.Add(new Annotation("Foo" + i + "Annotation1", "Foo" + i + "Value1"));
                foo.Annotations.Add(new Annotation("Foo" + i + "Annotation2", "Foo" + i + "Value2"));

                var goo = entityType.AddProperty(entityType.Type.GetProperty("Goo" + i));
            }

            var fk11 = entityType1.AddForeignKey(entityType2.GetKey(), new[] { entityType1.GetProperty("KoolEntity2Id") });
            var fk21 = entityType2.AddForeignKey(entityType1.GetKey(), new[] { entityType2.GetProperty("KoolEntity1Id1") });
            var fk22 = entityType2.AddForeignKey(entityType3.GetKey(), new[] { entityType2.GetProperty("KoolEntity3Id") });
            var fk31 = entityType3.AddForeignKey(entityType4.GetKey(), new[] { entityType3.GetProperty("KoolEntity4Id") });
            var fk61 = entityType6.AddForeignKey(entityType5.GetKey(), new[] { entityType6.GetProperty("Kool5Id") });

            entityType1.AddNavigation(new Navigation(fk11, "NavTo2", pointsToPrincipal: true));
            entityType1.AddNavigation(new Navigation(fk21, "NavTo2s", pointsToPrincipal: false));
            entityType2.AddNavigation(new Navigation(fk21, "NavTo1", pointsToPrincipal: true));
            entityType2.AddNavigation(new Navigation(fk11, "NavTo1s", pointsToPrincipal: false));
            entityType2.AddNavigation(new Navigation(fk22, "NavTo3", pointsToPrincipal: true));
            entityType3.AddNavigation(new Navigation(fk22, "NavTo2s", pointsToPrincipal: false));
            entityType3.AddNavigation(new Navigation(fk31, "NavTo4", pointsToPrincipal: true));
            entityType4.AddNavigation(new Navigation(fk31, "NavTo3s", pointsToPrincipal: false));
            entityType5.AddNavigation(new Navigation(fk61, "Kool6s", pointsToPrincipal: false));
            entityType6.AddNavigation(new Navigation(fk61, "Kool5", pointsToPrincipal: true));

            return model;
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:89,代码来源:CompiledModelTest.cs

示例9: BuildModel

        private static Model BuildModel()
        {
            var model = new Model();

            var entityType = new EntityType(typeof(Banana));
            var pkProperty = entityType.AddProperty("Id", typeof(int));
            var fkProperty = entityType.AddProperty("Fk", typeof(int));

            entityType.SetKey(pkProperty);
            var fk = entityType.AddForeignKey(entityType.GetKey(), fkProperty);

            entityType.AddProperty("Name", typeof(string));

            model.AddEntityType(entityType);

            entityType.AddNavigation(new Navigation(fk, "LesserBananas", pointsToPrincipal: false));
            entityType.AddNavigation(new Navigation(fk, "TopBanana", pointsToPrincipal: true));

            return model;
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:20,代码来源:RelationshipsSnapshotTest.cs

示例10: CreateModelWithForeignKeys

        private static IModel CreateModelWithForeignKeys()
        {
            var model = new Model();

            var houseType = new EntityType("Ho!use[]");
            var houseId = houseType.AddProperty("Id", typeof(int));
            houseType.SetKey(houseId);
            model.AddEntityType(houseType);

            var customerType = new EntityType(@"Customer");
            var customerId = customerType.AddProperty("Id", typeof(int));
            var customerFkProperty = customerType.AddProperty("HouseId", typeof(int));
            customerFkProperty.SetColumnName(@"House[""Id]Column");
            customerType.SetSchema("dbo");
            customerType.SetTableName(@"Cus[""om.er]s");
            customerType.SetKey(customerId);
            customerType.GetKey().SetKeyName(@"My[""PK]");
            customerType.GetKey().Annotations.Add(new Annotation(@"My""PK""Annotat!on", @"""Foo"""));
            var customerFk = customerType.AddForeignKey(houseType.GetKey(), customerFkProperty);
            customerFk.SetKeyName(@"My_[""FK]");
            customerFk.Annotations.Add(new Annotation(@"My""FK""Annotation", @"""Bar"""));
            model.AddEntityType(customerType);

            var orderType = new EntityType(@"Order");
            var orderId = orderType.AddProperty(@"OrderId", typeof(int));
            var orderFK = orderType.AddProperty(@"CustomerId", typeof(int));
            orderType.SetSchema("dbo");
            orderType.SetKey(orderId);
            orderType.SetTableName(@"Ord[""e.r]s");
            orderType.AddForeignKey(customerType.GetKey(), orderFK);
            orderType.Annotations.Add(new Annotation("Random annotation", "42"));
            model.AddEntityType(orderType);

            return model;
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:35,代码来源:MigrationScaffolderTest.cs

示例11: CreateModelWithCompositeKeys

        private static IModel CreateModelWithCompositeKeys()
        {
            var model = new Model();
            var entity1 = new EntityType("EntityWithNamedKeyAndAnnotations");

            var id1 = entity1.AddProperty("Id", typeof(int));
            id1.Annotations.Add(new Annotation("Id_Annotation1", "Id1"));
            id1.Annotations.Add(new Annotation("Id_Annotation2", "Id2"));
            var foo1 = entity1.AddProperty("Foo", typeof(int));
            foo1.Annotations.Add(new Annotation("Foo_Annotation", "Foo"));

            entity1.SetKey(id1, foo1);
            entity1.GetKey().SetKeyName("MyPK1");
            entity1.GetKey().Annotations.Add(new Annotation("KeyAnnotation1", "Key1"));
            entity1.GetKey().Annotations.Add(new Annotation("KeyAnnotation2", "Key2"));
            model.AddEntityType(entity1);

            var entity2 = new EntityType("EntityWithUnnamedKeyAndAnnotations");

            var id2 = entity2.AddProperty("Id", typeof(int));
            id2.Annotations.Add(new Annotation("Id_Annotation1", "Id1"));
            id2.Annotations.Add(new Annotation("Id_Annotation2", "Id2"));
            var foo2 = entity2.AddProperty("Foo", typeof(int));
            foo2.Annotations.Add(new Annotation("Foo_Annotation", "Foo"));

            entity2.SetKey(id2, foo2);
            entity2.GetKey().Annotations.Add(new Annotation("KeyAnnotation1", "Key1"));
            entity2.GetKey().Annotations.Add(new Annotation("KeyAnnotation2", "Key2"));
            model.AddEntityType(entity2);

            var entity3 = new EntityType("EntityWithNamedKey");
            var id3 = entity3.AddProperty("Id", typeof(int));
            var foo3 = entity3.AddProperty("Foo", typeof(int));
            entity3.SetKey(id3, foo3);
            entity3.GetKey().SetKeyName("MyPK2");
            model.AddEntityType(entity3);

            var entity4 = new EntityType("EntityWithUnnamedKey");
            var id4 = entity4.AddProperty("Id", typeof(int));
            var foo4 = entity4.AddProperty("Foo", typeof(int));
            entity4.SetKey(id4, foo4);
            model.AddEntityType(entity4);

            return model;
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:45,代码来源:MigrationScaffolderTest.cs

示例12: BuildModel

        private static Model BuildModel()
        {
            var model = new Model();

            var entityType = new EntityType(typeof(Banana));
            var property1 = entityType.AddProperty("P1", typeof(int));
            var property2 = entityType.AddProperty("P2", typeof(string));
            var property3 = entityType.AddProperty("P3", typeof(Random));
            var property4 = entityType.AddProperty("P4", typeof(int));
            var property5 = entityType.AddProperty("P5", typeof(string));
            var property6 = entityType.AddProperty("P6", typeof(Random));

            entityType.SetKey(property1, property2, property3);
            entityType.AddForeignKey(entityType.GetKey(), property6, property4, property5);

            model.AddEntityType(entityType);

            return model;
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:19,代码来源:CompositeEntityKeyFactoryTest.cs

示例13: Can_clear_key

        public void Can_clear_key()
        {
            var entityType = new EntityType(typeof(Customer));

            var property1 = entityType.AddProperty(Customer.IdProperty);
            var property2 = entityType.AddProperty(Customer.NameProperty);

            entityType.SetKey(property1, property2);

            Assert.Equal(2, entityType.GetKey().Properties.Count());

            entityType.SetKey(null);

            Assert.Null(entityType.TryGetKey());
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:15,代码来源:EntityTypeTest.cs

示例14: Can_get_set_reset_and_clear_primary_key

        public void Can_get_set_reset_and_clear_primary_key()
        {
            var entityType = new EntityType(typeof(Customer), new Model());
            var idProperty = entityType.GetOrAddProperty(Customer.IdProperty);
            var nameProperty = entityType.GetOrAddProperty(Customer.NameProperty);

            var key1 = entityType.GetOrSetPrimaryKey(new[] { idProperty, nameProperty });

            Assert.NotNull(key1);
            Assert.Same(key1, entityType.GetOrSetPrimaryKey(new[] { idProperty, nameProperty }));
            Assert.Same(key1, entityType.GetPrimaryKey());

            Assert.Same(key1, entityType.FindPrimaryKey());
            Assert.Same(key1, entityType.Keys.Single());

            var key2 = entityType.GetOrSetPrimaryKey(idProperty);

            Assert.NotNull(key2);
            Assert.NotEqual(key1, key2);
            Assert.Same(key2, entityType.GetOrSetPrimaryKey(idProperty));
            Assert.Same(key2, entityType.GetPrimaryKey());
            Assert.Same(key2, entityType.FindPrimaryKey());
            Assert.Equal(2, entityType.Keys.Count);
            Assert.Same(key1, entityType.GetKey(key1.Properties));
            Assert.Same(key2, entityType.GetKey(key2.Properties));

            Assert.Null(entityType.GetOrSetPrimaryKey((Property)null));

            Assert.Null(entityType.FindPrimaryKey());
            Assert.Equal(2, entityType.Keys.Count);

            Assert.Null(entityType.GetOrSetPrimaryKey(new Property[0]));

            Assert.Null(entityType.FindPrimaryKey());
            Assert.Equal(2, entityType.Keys.Count);
            Assert.Equal(
                Strings.EntityRequiresKey(typeof(Customer).FullName),
                Assert.Throws<ModelItemNotFoundException>(() => entityType.GetPrimaryKey()).Message);
        }
开发者ID:thegido,项目名称:EntityFramework,代码行数:39,代码来源:EntityTypeTest.cs

示例15: BuildModel

        private static Model BuildModel()
        {
            var model = new Model();

            var entityType = new EntityType(typeof(Banana));
            var property1 = entityType.AddProperty("P1", typeof(int));
            var property2 = entityType.AddProperty("P2", typeof(string));

            entityType.SetKey(property1);
            entityType.AddForeignKey(entityType.GetKey(), property2);

            model.AddEntityType(entityType);

            return model;
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:15,代码来源:SimpleEntityKeyFactoryTest.cs


注:本文中的EntityType.GetKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。