We are transferring some data from MongoDB to SQL Server. To store mongo's objectid in SQL Server, I have a column of type varbinary(12).
Question #1: is this a correct way to store mongo's objected in SQL Server?
Also when I convert objectid using
select CONVERT(varbinary(12),'54aedb94e6c12b1c0e83385f') I get back 0x353461656462393465366331
Question #2: in C#, how do I convert this stored binary back to string hexadecimal value?
Question #3: I am using EF with a database-first approach. How do I query the SQL Server table for the matching objectid (considering Objectid is stored as varbinary)
public vod DoWork(string mongoid) { //how do i get client based on `mongoid` parameter which is string? var result = _dbContext.Clients.SingleOrDefault(x=>x.MongoId == ?????) } assume that MongoId is varbinary column
'54aedb94e6c12b1c0e83385f'?