public void Init() { var stream = GetValidStream(); var options = new CredentialProfileOptions { AccessKey = System.Environment.GetEnvironmentVariable("AWSACCESSKEY"), SecretKey = System.Environment.GetEnvironmentVariable("AWSSECRET") }; var profile = new Amazon.Runtime.CredentialManagement.CredentialProfile("basic_profile", options); var netSDKFile = new NetSDKCredentialsFile(); var region = Amazon.RegionEndpoint.GetBySystemName(stream.AwsRegion); var creds = AWSCredentialsFactory.GetAWSCredentials(profile, netSDKFile); var connection = new AwsHttpConnection(creds, region); var pool = new SingleNodeConnectionPool(new Uri(stream.ElasticSearchDomainName)); var config = new Nest.ConnectionSettings(pool, connection); var client = new ElasticClient(config); if (client.Indices.Exists(stream.ElasticSearchIndexName).Exists) { var res = client.Indices.Delete(stream.ElasticSearchIndexName); Console.WriteLine(res.DebugInformation); } }
/// <summary> /// Creates a new profile in the AWS SDK Store for storing credentials in encrypted form. /// </summary> /// <remarks> /// The encrypted credentials in the SDK Store are located in the'%LOCALAPPDATA%\AWSToolkit' /// folder in the RegisteredAccounts.json file. /// </remarks> /// <param name="profileName">Profile name to associate with credentials.</param> /// <param name="accessKey">The access key to store with <paramref name="profileName"/>.</param> /// <param name="secretKey">The secret key to store with <paramref name="profileName"/>.</param> /// <param name="region">The AWS region to associate with <paramref name="profileName"/>.</param> /// <returns>Successful or not result.</returns> private static bool RegisterAccount(string profileName, string accessKey, string secretKey, string region) { var chain = new CredentialProfileStoreChain(); if (chain.ListProfiles().Any(p => p.Name.Equals(profileName, StringComparison.InvariantCultureIgnoreCase))) { MessageBox.Show("The profile name already exists in one or more locations.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } var options = new CredentialProfileOptions { AccessKey = accessKey, SecretKey = secretKey }; var profile = new CredentialProfile(profileName, options); var netSdkFile = new NetSDKCredentialsFile(); profile.Region = RegionEndpoint.GetBySystemName(region); netSdkFile.RegisterProfile(profile); MessageBox.Show("AWS account was stored successfully.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); return(true); }
/** * This method reads the key specified in PollyProperties and sets it as the new AWS profile. * At the moment, the region is always set to EU which is something you might want to care for. * Except for setting up the account, it is not used or verified at this point. * The method only fails if there is something wrong with the KeyFile. */ private void SetAwsProfile(PollyProperties pollyProps) { // Read the Credentials and store them shortly in an array var path = pollyProps.ApiKey; var credentialFile = new Dictionary <string, string>(); foreach (var row in File.ReadAllLines(path)) { credentialFile.Add(row.Split('=')[0], string.Join("=", row.Split('=').Skip(1).ToArray())); } // Create Amazon Credentials var options = new CredentialProfileOptions { AccessKey = credentialFile["AWSAccessKeyId"], SecretKey = credentialFile["AWSSecretKey"] }; // Make Amazon Credential profile var profile = new Amazon.Runtime.CredentialManagement.CredentialProfile("polly_profile", options); profile.Region = RegionEndpoint.EUCentral1; this._awsProfile = profile; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); services.AddControllersWithViews(); services.AddIdentity <ApplicationUser, IdentityRole>(options => { options.Password.RequireLowercase = false; options.Password.RequireUppercase = false; options.Password.RequireNonAlphanumeric = false; options.Password.RequireDigit = false; }) .AddEntityFrameworkStores <ApplicationDbContext>() .AddDefaultTokenProviders(); //Navigate users to login page if they are trying to access to authorized page while not logged in services.ConfigureApplicationCookie(options => options.LoginPath = "/Home/LogIn"); //method to register the profile. var options = new CredentialProfileOptions { AccessKey = Configuration.GetConnectionString("AWSAccessKey"), SecretKey = Configuration.GetConnectionString("AWSSecretKey"), }; var profile = new CredentialProfile("default", options); profile.Region = RegionEndpoint.USEast1; var netSDKFile = new NetSDKCredentialsFile(); netSDKFile.RegisterProfile(profile); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); // The AWS credentials should be provide via a profile or other more secure means. This is only for example. // See http://http://docs.aws.amazon.com/sdk-for-net/v3/developer-guide/net-dg-config-creds.html var options = new CredentialProfileOptions { AccessKey = "AKIAJWXCD7ZCUGRQYCMA", SecretKey = "rFHsownm28o/6EvzpMkCF/7lhWWjbhS1RGHA2y5k" }; var profile = new CredentialProfile("default", options) { Region = RegionEndpoint.USWest2 }; new NetSDKCredentialsFile().RegisterProfile(profile); var producer = MessagingScenarioFactory.CreateQueueProducer("queue"); var consumer = MessagingScenarioFactory.CreateQueueConsumer("queue"); consumer.Start(); consumer.MessageReceived += (sender, eventArgs) => { var eventArgsMessage = eventArgs.Message; var message = eventArgsMessage.GetStringValue(); Console.WriteLine($"Message: {message}"); }; producer.Send("Test SQS Message!"); }
public static void RegisterProfile(CredentialProfileOptions profileOptions, string name, string profileLocation, RegionEndpoint region) { var profile = new CredentialProfile(name, profileOptions); profile.Region = region; new CredentialProfileStoreChain(profileLocation).RegisterProfile(profile); }
public async Task <bool> Exists() { CredentialProfileOptions options = new CredentialProfileOptions(); Settings settings = Settings.Load(); options.AccessKey = settings.DBKey; options.SecretKey = settings.DBSecret; CredentialProfile profile = new CredentialProfile("Default", options); profile.Region = RegionEndpoint.APSoutheast2; SharedCredentialsFile sharedFile = new SharedCredentialsFile(); sharedFile.RegisterProfile(profile); AmazonDynamoDBConfig dbConfig = new AmazonDynamoDBConfig(); this.client = new AmazonDynamoDBClient(dbConfig); ListTablesResponse listTablesResponse = await this.client.ListTablesAsync(); return(listTablesResponse.TableNames.Contains(this.InternalName)); }
public async Task <InvokeResult> InitAsync(DataStream stream) { _stream = stream; var options = new CredentialProfileOptions { AccessKey = stream.AwsAccessKey, SecretKey = stream.AwsSecretKey }; var profile = new Amazon.Runtime.CredentialManagement.CredentialProfile($"awsprofile_{stream.Id}", options); var netSDKFile = new NetSDKCredentialsFile(); netSDKFile.RegisterProfile(profile); var creds = AWSCredentialsFactory.GetAWSCredentials(profile, netSDKFile); try { _s3Client = new AmazonS3Client(creds, AWSRegionMappings.MapRegion(stream.AwsRegion)); await _s3Client.EnsureBucketExistsAsync(stream.S3BucketName); } catch (AmazonS3Exception amazonS3Exception) { _logger.AddException("AWSS3Connector_InitAsync", amazonS3Exception); return(InvokeResult.FromException("AWSS3Connector_InitAsync", amazonS3Exception)); } return(InvokeResult.Success); }
public void AssertWriteProfile( string profileName, CredentialProfileOptions profileOptions, Dictionary <string, string> properties, RegionEndpoint region, Guid?uniqueKey, bool?endpointDiscoveryEnabled, RequestRetryMode?retryMode, int?maxAttempts, string expectedFileContents) { CredentialsFile.RegisterProfile( CredentialProfileTestHelper.GetCredentialProfile( uniqueKey: uniqueKey, profileName: profileName, options: profileOptions, properties: properties, defaultConfigurationModeName: null, region: region, endpointDiscoveryEnabled: endpointDiscoveryEnabled, retryMode: retryMode, maxAttempts: maxAttempts)); AssertCredentialsFileContents(expectedFileContents); }
private void btnCreateProfile_Click(object sender, EventArgs e) { String strProfileName = txtAWSProfileName.Text.Trim(); String strAccessKey = txtAWSAccessKey.Text.Trim(); String strSecretKey = txtAWSSecretKey.Text.Trim(); String strRegionServiceName = GetRegionEndpointServiceName(cboAWSRegions.Text.Trim()); var AmazonRegionEndpoint = RegionEndpoint.GetBySystemName(strRegionServiceName); var AWSProfileOptions = new CredentialProfileOptions { AccessKey = strAccessKey, SecretKey = strSecretKey }; var AWSProfile = new Amazon.Runtime.CredentialManagement.CredentialProfile(strProfileName, AWSProfileOptions); AWSProfile.Region = AmazonRegionEndpoint; //var AWSCredentialsFile = new Amazon.Runtime.CredentialManagement.SharedCredentialsFile(); var netSDKFile = new NetSDKCredentialsFile(); netSDKFile.RegisterProfile(AWSProfile); //refreshed the list of available profiles GetSavedProfiles(); GetProfilesToCleanUp(); //clear Create Profile Fields txtAWSProfileName.Text = ""; txtAWSAccessKey.Text = ""; txtAWSSecretKey.Text = ""; cboAWSRegions.Text = ""; cboAWSRegions.SelectedIndex = -1; btnCreateProfile.Enabled = false; }
public static CredentialProfileType?DetectProfileType(CredentialProfileOptions profileOptions) { CredentialProfileType?profileType = null; HashSet <string> propertyNames = GetPropertyNames(profileOptions); #if !BCL35 // Spec: If one or more of the SSO properties is present, the profile MUST be resolved by the SSO credential provider. if (propertyNames.Any(propertyName => SsoProperties.Contains(propertyName))) { return(CredentialProfileType.SSO); } #endif // brute force algorithm - but it's a very small set foreach (var pair in TypePropertyDictionary) { if (pair.Value.SetEquals(propertyNames)) { // exact match profileType = pair.Key; } } return(profileType); }
public void WriteRegionCredentialsUntouched() { using (var tester = new NetSDKCredentialsFileTestFixture()) { // write the whole profile - credentials options and region var basicOptions = new CredentialProfileOptions { AccessKey = "access_key", SecretKey = "secret_key" }; var profile = new CredentialProfile("WriteRegionKeepOptionsProfile", basicOptions); profile.Region = RegionEndpoint.USGovCloudWest1; tester.ProfileStore.RegisterProfile(profile); // now write just the region var emptyOptions = new CredentialProfileOptions(); var regionOnlyProfile = new CredentialProfile("WriteRegionKeepOptionsProfile", basicOptions); profile.Region = RegionEndpoint.APSouth1; tester.ProfileStore.RegisterProfile(profile); // Make sure it has the original options and the new region var readProfile = tester.TestTryGetProfile("WriteRegionKeepOptionsProfile", true, true); Assert.AreEqual("access_key", readProfile.Options.AccessKey); Assert.AreEqual("secret_key", readProfile.Options.SecretKey); Assert.AreEqual(RegionEndpoint.APSouth1, readProfile.Region); } }
public DaemonService( ILogger <DaemonService> logger, Simulator simulator, Scheduler scheduler) { _logger = logger; if (!string.IsNullOrEmpty(Shared.Configuration["aws_access_key_id"]) && !string.IsNullOrEmpty(Shared.Configuration["aws_secret_access_key"])) { var credentialFile = new NetSDKCredentialsFile(); var option = new CredentialProfileOptions { AccessKey = Shared.Configuration["aws_access_key_id"], SecretKey = Shared.Configuration["aws_secret_access_key"] }; var profile = new CredentialProfile("default", option) { Region = Amazon.RegionEndpoint.EUWest1 }; credentialFile.RegisterProfile(profile); } var serviceName = Shared.Configuration["ServiceName"]; if ("simulator".Equals(serviceName, StringComparison.OrdinalIgnoreCase)) { _task = simulator; } else { _task = scheduler; } }
public async Task <IActionResult> ReplicationDetails(String tableName) { NetSDKCredentialsFile credentialsFile = new NetSDKCredentialsFile(); CredentialProfileOptions options = new CredentialProfileOptions(); options.AccessKey = HttpContext.Session.GetString("AccessKey"); options.SecretKey = HttpContext.Session.GetString("SecretKey"); credentialsFile.RegisterProfile(new CredentialProfile("default", options)); DescribeTableStatisticsRequest request = new DescribeTableStatisticsRequest(); request.ReplicationTaskArn = HttpContext.Session.GetString("ReplicationTaskArn"); request.Filters.Add(new Filter { Name = "table-name", Values = { tableName } }); var statistics = await DbMigrationService.DescribeTableStatisticsAsync(request); var item = statistics.TableStatistics.SingleOrDefault(t => t.TableName == tableName); if (item == null) { return(NotFound()); } return(View(new DisplayTableStatistics(item, displayIcon(item.TableName), statusColor(item)))); }
private Dictionary <string, string> Convert(CredentialProfileOptions profileOptions) { var dictionary = new Dictionary <string, string>(); // if profileOptions.IsEmpty then leave all the credentials keys untouched if (!profileOptions.IsEmpty) { var properties = typeof(CredentialProfileOptions).GetProperties(); // ensure repeatable order Array.Sort(properties.Select((p) => p.Name).ToArray(), properties); foreach (var property in properties) { var value = (string)property.GetValue(profileOptions, null); if (string.IsNullOrEmpty(value)) { value = null; } if (nameMapping[property.Name] != null) { dictionary.Add(nameMapping[property.Name], value); } } } return(dictionary); }
/// <summary> /// Separate the profileDictionary into its parts. /// profileDictionary = profileOptions + reservedProperties + userProperties /// </summary> /// <param name="profileDictionary">Dictionary with everything in it</param> /// <param name="reservedKeys">Keys to ignore</param> /// <param name="profileOptions">The resulting CredentialProfileOptions</param> /// <param name="userProperties">The properties that are left</param> public void ExtractProfileParts(Dictionary <string, string> profileDictionary, HashSet <string> reservedKeys, out CredentialProfileOptions profileOptions, out Dictionary <string, string> userProperties) { Dictionary <string, string> reservedProperties; ExtractProfileParts(profileDictionary, reservedKeys, out profileOptions, out reservedProperties, out userProperties); }
public static CredentialProfileOptions GetRandomOptions(CredentialProfileType profileType) { CredentialProfileOptions options = new CredentialProfileOptions(); foreach (var propertyName in CredentialProfileTypeDetector.GetPropertiesForProfileType(profileType)) { typeof(CredentialProfileOptions).GetProperty(propertyName).SetValue(options, Guid.NewGuid().ToString()); } return options; }
public async Task <IActionResult> Apply(LoginModel model) { DbContextService service = new DbContextService(_appSettings); try{ BaseContext context = service.CreateDbContext(model); var person = context.Person.Take(1).ToList(); ViewData["PrimaryConnectionMessage"] = "Primary Connection Test Successful"; ViewData["PrimaryConnectionError"] = false; } catch (Exception ex) { ViewData["PrimaryConnectionMessage"] = ex.Message; ViewData["PrimaryConnectionError"] = true; } if (!String.IsNullOrEmpty(model.ReplicaDatabaseName)) { try{ BaseContext context = service.CreateReplicaDbContext(model); var person = context.Person.Take(1).ToList(); ViewData["ReplicaConnectionMessage"] = "Secondary Connection Test Successful"; ViewData["ReplicaConnectionError"] = false; }catch (Exception ex) { ViewData["ReplicaConnectionMessage"] = ex.Message; ViewData["ReplicaConnectionError"] = true; } } if (!String.IsNullOrEmpty(model.ReplicationTaskArn) && !String.IsNullOrEmpty(model.AccessKey) && !String.IsNullOrEmpty(model.SecretKey) && !String.IsNullOrEmpty(model.EndPointArn)) { try{ NetSDKCredentialsFile credentialsFile = new NetSDKCredentialsFile(); CredentialProfileOptions options = new CredentialProfileOptions(); options.AccessKey = model.AccessKey; options.SecretKey = model.SecretKey; credentialsFile.RegisterProfile(new CredentialProfile("default", options)); TestConnectionRequest request = new TestConnectionRequest(); request.ReplicationInstanceArn = model.ReplicationTaskArn; request.EndpointArn = model.EndPointArn; var statistics = await _migrationService.TestConnectionAsync(request); ViewData["AWSConnectionMessage"] = "AWS API Connection Test Successful"; ViewData["AWSConnectionError"] = false; } catch (Exception ex) { ViewData["AWSConnectionMessage"] = ex.Message; ViewData["AWSConnectionError"] = true; } } return(Index(model)); }
public async Task Connect() { CredentialProfileOptions options = new CredentialProfileOptions(); Settings settings = Settings.Load(); options.AccessKey = settings.DBKey; options.SecretKey = settings.DBSecret; CredentialProfile profile = new CredentialProfile("Default", options); profile.Region = RegionEndpoint.APSoutheast2; SharedCredentialsFile sharedFile = new SharedCredentialsFile(); sharedFile.RegisterProfile(profile); AmazonDynamoDBConfig dbConfig = new AmazonDynamoDBConfig(); this.client = new AmazonDynamoDBClient(dbConfig); await this.EnsureTable(); this.context = new DynamoDBContext(this.client); foreach (JsonConverter converter in Serializer.Options.Converters) { PropertyInfo prop = converter.GetType().GetProperty("TypeToConvert", BindingFlags.Instance | BindingFlags.NonPublic); if (prop == null) { throw new Exception("Failed to get target type of json converter: " + converter); } Type?targetType = prop.GetValue(converter) as Type; if (targetType == null) { throw new Exception("Failed to get target type of json converter: " + converter); } this.context.ConverterCache.Add(targetType, new JsonProperty(targetType)); } try { await this.client.ListTablesAsync(); } catch (Exception ex) { throw new Exception("Unable to connect to database: " + ex.Message, ex); } this.operationConfig = new DynamoDBOperationConfig(); this.operationConfig.OverrideTableName = this.InternalName; }
private static void RegisteOtherProfile(NetSDKCredentialsFileTestFixture tester) { var options = new CredentialProfileOptions { AccessKey = "ak", SecretKey = "sk" }; tester.ProfileStore.RegisterProfile(new CredentialProfile("OtherProfile", options)); }
public CredentialProfile ReadAndAssertProfile(string profileName, CredentialProfileOptions expectedProfileOptions, Dictionary <string, string> expectedProperties, RegionEndpoint expectedRegion, Guid?expectedUniqueKey) { var expectedProfile = CredentialProfileTestHelper.GetCredentialProfile(expectedUniqueKey, profileName, expectedProfileOptions, expectedProperties, expectedRegion); var actualProfile = TestTryGetProfile(profileName, true, expectedProfile.CanCreateAWSCredentials); Assert.AreEqual(expectedProfile, actualProfile); return(actualProfile); }
public static void RegisterProfile(string profileName, string accessKey, string accessSecret) { var option = new CredentialProfileOptions { AccessKey = accessKey, SecretKey = accessSecret }; new NetSDKCredentialsFile().RegisterProfile(new CredentialProfile(profileName, option)); }
public static void Main() { var options = new CredentialProfileOptions { AccessKey = "AKIAIXAZZ67QITDQHCJA", SecretKey = "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" }; client = new AmazonS3Client(bucketRegion); WritingAnObjectAsync().Wait(); }
public static void Main() { var options = new CredentialProfileOptions { AccessKey = "放在rdisk", SecretKey = "放在rdisk" }; var profile = new Amazon.Runtime.CredentialManagement.CredentialProfile("gino355140", options); profile.Region = RegionEndpoint.APNortheast3; //var netSDKFile = new NetSDKCredentialsFile(); //netSDKFile.RegisterProfile(profile); using (var client = new AmazonS3Client(options.AccessKey, options.SecretKey, profile.Region)) { clientS3 = client; var response = client.ListBucketsAsync(); var list = response.Result; //可列出所有Bucket,範例先以自己的做測試 S3Bucket s3Bucket = list.Buckets.Find(x => x.BucketName == bucketName); Console.WriteLine("S3 Start"); Console.WriteLine("---------------------"); //"2021/01/SQL_Test.csv","123.csv" 測試用檔名 string fileName = "2021/02/SQL_Test_big.csv"; string sqlStr = "Select * from S3Object"; //除from S3Object固定外,其餘皆和一般SQL語法相同 //列出bucket and bucket內的東西 DateTime start = new DateTime(2021, 01, 01); //起始時間 DateTime end = new DateTime(2021, 03, 30); //結束時間 List <string> keys = getYearMotnhs(start, end); //時間區間轉字串 foreach (string key in keys) { ListingObjectsAsync(key).Wait(); } Console.WriteLine("---------------------"); //讀取bucket and bucket內的東西 var result = ReadObjectDataAsync(fileName).Result; Console.WriteLine("---------------------"); //讀取bucket內的東西 by sql var result2 = GetSelectObjectContent("2021/01/SQL_Test.csv", sqlStr); Console.WriteLine("---------------------"); //上傳物件,測試前請先看一下上傳內容 //WritingAnObjectAsync().Wait(); Console.WriteLine("---------------------"); Console.WriteLine("S3 End"); } }
public async Task <IActionResult> RegisterProfile([FromBody] AWSProfileCredentials aWSCredentials) { try { using (IAmazonS3 amazonS3 = new AmazonS3Client(aWSCredentials.AccessKey, aWSCredentials.SecretKey, RegionEndpoint.USEast1)) { try { var s3Resource = await amazonS3.ListBucketsAsync(); } catch (Amazon.S3.AmazonS3Exception ex) { if (ex.ErrorCode.Equals("InvalidAccessKeyId") || ex.ErrorCode.Equals("SignatureDoesNotMatch")) { return(BadRequest(new { Message = "Invalid access or secret key" })); } } } var netSDKFile = new SharedCredentialsFile(); CredentialProfile basicProfile; if (netSDKFile.TryGetProfile(aWSCredentials.ProfileName, out basicProfile)) { netSDKFile.UnregisterProfile(aWSCredentials.ProfileName); CredentialProfileOptions options = new CredentialProfileOptions() { AccessKey = aWSCredentials.AccessKey, SecretKey = aWSCredentials.SecretKey }; var profile = new CredentialProfile(aWSCredentials.ProfileName, options); netSDKFile = new SharedCredentialsFile(); netSDKFile.RegisterProfile(profile); } else { CredentialProfileOptions options = new CredentialProfileOptions() { AccessKey = aWSCredentials.AccessKey, SecretKey = aWSCredentials.SecretKey }; var profile = new CredentialProfile(aWSCredentials.ProfileName, options); //netSDKFile = new SharedCredentialsFile(Directory.GetCurrentDirectory()+ @"\Credentials"); netSDKFile = new SharedCredentialsFile(); netSDKFile.RegisterProfile(profile); } return(Ok("Registered")); } catch (Exception ex) { return(BadRequest(ex.Message + ex.StackTrace)); } }
private void Authenticate() { CredentialProfileOptions options = new CredentialProfileOptions() { AccessKey = _accesKey, SecretKey = _secretKey }; CredentialProfile profile = new CredentialProfile("basic_profile", options); var netSDKFile = new NetSDKCredentialsFile(); netSDKFile.RegisterProfile(profile); }
public static CredentialProfile CreateAWSProfile(ref string[] credentials) { string[] s = new string[1]; GetCredentials(ref s); CredentialProfileOptions cpo = new CredentialProfileOptions(); cpo.AccessKey = s[0]; cpo.SecretKey = s[1]; CredentialProfile cp = new CredentialProfile("ff_runtime", cpo); return(cp); }
public void RegisterProfile(string profileName, string accessKey, string secretKey) { var options = new CredentialProfileOptions { AccessKey = accessKey, SecretKey = secretKey, }; var profile = new CredentialProfile(profileName, options); var credentialsFile = CreateCredentialProfileStore(); credentialsFile.RegisterProfile(profile); }
internal static void RegisterAWSCredentialProfile(string profileName, string accessKey, string secretKey, string region) { var options = new CredentialProfileOptions { AccessKey = accessKey, SecretKey = secretKey }; var profile = new Amazon.Runtime.CredentialManagement.CredentialProfile(profileName, options); var file = Program.GetCredentialStore(); file.RegisterProfile(profile); }
private static HashSet <string> GetPropertyNames(CredentialProfileOptions profileOptions) { HashSet <string> propertyNames = new HashSet <string>(); foreach (var property in typeof(CredentialProfileOptions).GetProperties()) { var value = (string)property.GetValue(profileOptions, null); if (!string.IsNullOrEmpty(value)) { propertyNames.Add(property.Name); } } return(propertyNames); }