Adding values that doesn't exist in object

  • Thread starter Thread starter Priya Bange
  • Start date Start date
P

Priya Bange

Guest
Hi Experts,

Am still on track to learn C#. Could you please help with below problem.

I have configuration app.config that contains comma-separated values which are basically server_names

Example

Config_Values --> Server_1, Server_2

I will be using quartz library to execute every 30 second to read a table from a DB which contains data in below format is in DB using Dapper or Ado.net.

Data Set from DB

Query_ID Query Database_Name
1 SELECT * FROM XYZ Master
2 SELECT * FROM dbo.ABC Master



Problem 1 : For every server read from the config file I need to map them together.

Now, I need to load the return data set into an object with below format "Problem"

Query_ID Query Database_Name Server_Name
1 SELECT * FROM XYZ Master Server_1
2 SELECT * FROM dbo.ABC Master Server_1
1 SELECT * FROM XYZ Master Server_2
2 SELECT * FROM dbo.ABC Master Server_2



Now as am doing query to DB every 30 seconds there could be possibility new Query_ID is available to be loaded in the object

Problem 2 : Add only those Query_ID + Server_Name combination to the object which are new so final result something like below

Read data from DB again (I will be able to handle it using Quartz)

Query_ID Query Database_Name

Query_ID Query Database_Name
1 SELECT * FROM XYZ Master
2 SELECT * FROM dbo.ABC Master
3 SELECT * FROM dbo.Emp AdventureWorks




Problem load the existing object with only new Query_ID + Server_Name combination

Query_ID Query Database_Name Server_Name
1 SELECT * FROM XYZ Master Server_1
2 SELECT * FROM dbo.ABC Master Server_1
1 SELECT * FROM XYZ Master Server_2
2 SELECT * FROM dbo.ABC Master Server_2
3 SELECT * FROM dbo.Emp AdventureWorks Server_1
3 SELECT * FROM dbo.Emp AdventureWorks Server_2





Kindly help

Thanks

Priya

Continue reading...
 
Back
Top