I have the following code:
var db = new IpsDBDataContext(connectionString);
var record = new IpsJobQueue();
var config = new IpsJobFileConfig();
record.FileName = file.Name;
record.FileNameConventionID = ....?
record.PickupDate = DateTime.Now;
// hard coded to follow suit with "unprocessed" flag in
// IpsJobProcessCodes table.
record.ProcessStatus = 1;
record.CreationTime = file.CreationTime;
record.StartTime = null;
record.EndTime = null;
db.IpsJobQueues.InsertOnSubmit(record);
db.SubmitChanges();
The line I am concerned with is record.FilenameConventionID = ...?
Here, I need to assign the FileNameConventionID to a ID (as a foreign key) in the IpsJobFileConfig table where the PublisherName column = “Undetermined”. Thats easy to do but the issue is the ID that is associated with this record type (Undetermined) will likely change as it gets promoted to production.
So what i perceive I need to do will be in two steps.
- Find the record whose
PublisherName = Undetermined - Get the
IDon that record (as it will be dynamic).
The question is: How do I reflexively get the ID off the column whose record I am selecting?
Right now you’re creating a new
IpsJobFileConfigrecord but not using it. I’m guessing you could get rid of that altogether.You should be able to get away with (assuming any record in the IpsJobFileConfig table with the correct publisher name will work since there could be multiple rows):