public void T_17_VersionChange_AmorphousExtra() { var BYTES = new byte[] { 0x00, 0x79, 0x14 }; var rowA = new RowVersionA { FirstName = "Vladimir", LastName = "Lenin", Age = DateTime.Now.Year - 1870 }; rowA.AmorphousData["AABB"] = "extra data"; rowA.AmorphousData["Bytes"] = BYTES; var rc = new RowConverter(); var doc = rc.RowToBSONDocument(rowA, "A", useAmorphousData: true); Console.WriteLine(doc.ToString()); var rowB = new RowVersionB(); rc.BSONDocumentToRow(doc, rowB, "MyLegacySystem", useAmorphousData: true); Assert.AreEqual("Vladimir", rowB.FirstName); Assert.AreEqual("Lenin", rowB.LastName); Assert.AreEqual(1870, rowB.DOB.Year); Assert.AreEqual("extra data", rowB.AmorphousData["AABB"]); Assert.IsTrue(BYTES.SequenceEqual((byte[])rowB.AmorphousData["Bytes"])); }
public override void Put(Message message, object transaction) { if (DisposeStarted) { return; } var channel = message.Channel; if (channel.IsNullOrWhiteSpace()) { channel = m_DefaultChannel; } var doc = m_Serializer.Serialize(message, KNOWN_TYPES); var map = Mapper.StoreMap(message.ArchiveDimensions); if (map != null) { foreach (var item in map) { doc.Set(RowConverter.String_CLRtoBSON("__" + item.Key, item.Value)); } } m_Database[channel].Insert(doc); }
public void T_06_TargetingInnerRows() { var row = new RowB { Row1 = new RowA { String1 = "Mudaker", String2 = "Someone" }, Row2 = new RowA { String1 = "Zar", String2 = "Boris" } }; var rc = new RowConverter(); var doc = rc.RowToBSONDocument(row, "A"); Console.WriteLine(doc.ToString()); Assert.AreEqual("Someone", ((BSONDocumentElement)doc["Row1"]).Value["s2"].ObjectValue.ToString()); Assert.AreEqual("Boris", ((BSONDocumentElement)doc["Row2"]).Value["s2"].ObjectValue.ToString()); doc = rc.RowToBSONDocument(row, "B"); Console.WriteLine(doc.ToString()); Assert.AreEqual("Someone", ((BSONDocumentElement)doc["Row1"]).Value["STRING-2"].ObjectValue.ToString()); Assert.AreEqual("Boris", ((BSONDocumentElement)doc["Row2"]).Value["STRING-2"].ObjectValue.ToString()); doc = rc.RowToBSONDocument(row, "NonExistent"); Console.WriteLine(doc.ToString()); Assert.AreEqual("Someone", ((BSONDocumentElement)doc["Row1"]).Value["String2"].ObjectValue.ToString()); Assert.AreEqual("Boris", ((BSONDocumentElement)doc["Row2"]).Value["String2"].ObjectValue.ToString()); }
public AverageSummariser(IHaveColumns table, RowConverter converter) { _table = table; _converter = converter; _columnSummary = table.Columns.Select((c, index) => _GetSummariserFor(index, c.Type)).ToList(); }
private TodoFrame toFrame(TodoQueue queue, BSONDocument doc) { try { var result = new TodoFrame(); result.ID = RowConverter.GDID_BSONtoCLR(doc[Query._ID] as BSONBinaryElement); result.Type = Guid.Parse(((BSONStringElement)doc[FLD_TODO_TYPE]).Value); result.CreateTimestampUTC = ((BSONDateTimeElement)doc[FLD_TODO_CREATETIMESTAMP]).Value; result.ShardingKey = elmStr(doc[FLD_TODO_SHARDINGKEY]); result.ParallelKey = elmStr(doc[FLD_TODO_PARALLELKEY]); result.Priority = ((BSONInt32Element)doc[FLD_TODO_PRIORITY]).Value; result.StartDate = ((BSONDateTimeElement)doc[FLD_TODO_STARTDATE]).Value; result.CorrelationKey = elmStr(doc[FLD_TODO_CORRELATIONKEY]); result.State = ((BSONInt32Element)doc[FLD_TODO_STATE]).Value; result.Tries = ((BSONInt32Element)doc[FLD_TODO_TRIES]).Value; result.Serializer = ((BSONInt32Element)doc[FLD_TODO_SERIALIZER]).Value; result.Content = elmBin(doc[FLD_TODO_CONTENT]); return(result); } catch (Exception error) { throw new MongoWorkersException(StringConsts.TODO_QUEUE_BSON_READ_ERROR.Args(queue, error.ToMessageWithType()), error); } }
public void T_09_DynamicRow() { var schema = new Schema("Dynamic Schema", new Schema.FieldDef("ID", typeof(int), new List <FieldAttribute> { new FieldAttribute(required: true, key: true) }), new Schema.FieldDef("Description", typeof(string), new List <FieldAttribute> { new FieldAttribute(required: true) }) ); var row = new DynamicRow(schema); row["ID"] = 123; row["Description"] = "T-90 Tank"; var rc = new RowConverter(); var doc = rc.RowToBSONDocument(row, "A"); Console.WriteLine(doc.ToString()); var row2 = new DynamicRow(schema); rc.BSONDocumentToRow(doc, row2, "A"); Assert.AreEqual(123, row2["ID"]); Assert.AreEqual("T-90 Tank", row2["Description"]); }
public async Task <ActionResult <bool> > PutRow([FromBody] RowDto row) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } while (_context.Services.Any(u => u.RowId == row.Id)) { _context.Services.Remove(await _context.Services.FirstOrDefaultAsync(u => u.RowId == row.Id)); await _context.SaveChangesAsync(); } _context.Update(RowConverter.RowConvert(row)); try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RowExists(row.Id)) { return(NotFound()); } else { throw; } } return(Ok(true)); }
public void T_Null() { var rowA = new RowWithNulls { FirstName = "Vladimir", LastName = null, Age = 240, G_GDID = null }; var rc = new RowConverter(); var doc = rc.RowToBSONDocument(rowA, "A"); Console.WriteLine(doc["LastName"]); Console.WriteLine(doc["G_GDID"]); Console.WriteLine(doc.ToString()); var row2 = new RowWithNulls(); rc.BSONDocumentToRow(doc, row2, "A"); Assert.AreEqual("Vladimir", row2.FirstName); Assert.IsNull(row2.LastName); Assert.AreEqual(240, row2.Age); Assert.IsNull(row2.G_GDID); }
public void InferSchema() { var doc = new BSONDocument(); doc.Set(new BSONStringElement("FullName", "Alex Bobby")); doc.Set(new BSONInt32Element("Age", 123)); doc.Set(new BSONBooleanElement("IsGood", true)); var c = new RowConverter(); var schema = c.InferSchemaFromBSONDocument(doc); Assert.AreEqual(3, schema.FieldCount); Assert.AreEqual(0, schema["FullName"].Order); Assert.AreEqual(1, schema["Age"].Order); Assert.AreEqual(2, schema["IsGood"].Order); Assert.AreEqual(typeof(object), schema["FullName"].NonNullableType); Assert.AreEqual(typeof(object), schema["Age"].NonNullableType); Assert.AreEqual(typeof(object), schema["IsGood"].NonNullableType); var row = new DynamicRow(schema); c.BSONDocumentToRow(doc, row, null); Assert.AreEqual("Alex Bobby", row[0]); Assert.AreEqual(123, row[1]); Assert.AreEqual(true, row[2]); Assert.AreEqual("Alex Bobby", row["FullName"]); Assert.AreEqual(123, row["Age"]); Assert.AreEqual(true, row["IsGood"]); }
public void T_01_Equals() { var row = new RowA { String1 = "Mudaker", String2 = null, Date1 = new DateTime(1980, 07, 12), Date2 = null, Bool1 = true, Bool2 = null, Guid1 = new Guid("{9195F7DB-FE21-4BB2-B006-2496F4E24D14}"), Guid2 = null, Gdid1 = new GDID(0, 12345), Gdid2 = null, Float1 = 127.0123f, Float2 = null, Double1 = 122345.012d, Double2 = null, Decimal1 = 1234567.098M, Decimal2 = null, Amount1 = new Amount("din", 123.11M), Amount2 = null }; var rc = new RowConverter(); var doc = rc.RowToBSONDocument(row, "A"); Console.WriteLine(doc.ToString()); var row2 = new RowA(); rc.BSONDocumentToRow(doc, row2, "A"); Assert.IsTrue(row.Equals(row2)); }
public async Task <IActionResult> GetRow([FromRoute] int id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var rawRow = await _context.Rows.FindAsync(id); if (rawRow == null) { return(NotFound()); } var row = RowConverter.RowConvert(rawRow); if (row.Type == "MultiService") { foreach (var name in _context.Services.Where(u => u.RowId == row.Id).ToList()) { row.Names.Add(name.Name); } } return(Ok(row)); }
public async Task <HATEOASResult> SearchAsync(Guid tableId, string keyword, string column) { var rows = await rowService.SearchByKeywordAsync(tableId, keyword, column); var rowsResponse = rows.Select(r => RowConverter.GetRowResponse(r)).ToList(); return(this.HATEOASResult(rowsResponse, (r) => Ok(r))); }
public async Task <HATEOASResult> GetByTableAsync(Guid tableId) { var rows = await rowService.GetAllAsync(tableId); var rowsResponse = rows.Select(r => RowConverter.GetRowResponse(r)).ToList(); return(this.HATEOASResult(rowsResponse, (r) => Ok(r))); }
public async Task <HATEOASResult> GetAsync(Guid id) { var row = await rowService.GetAsync(id); var rowResponse = RowConverter.GetRowResponse(row); return(this.HATEOASResult(rowResponse, (r) => Ok(r))); }
private void SelectAndConvertColumns_button_Click(object sender, RibbonControlEventArgs e) { if (Globals.ThisAddIn.Application.Selection is Excel.Range) { Excel.Range rng = (Excel.Range)Globals.ThisAddIn.Application.Selection; if ((this.From_dropDown.SelectedItemIndex < 1 && rng.Columns.Count == 1) || (this.From_dropDown.SelectedItemIndex > 0 && rng.Columns.Count == 2)) { // Shift Cells so that nothing is overwritten if (this.To_dropDown.SelectedItemIndex < 1) { ((Excel.Range)rng.get_Item(1, rng.Columns.Count)).get_Offset(0, 1).EntireColumn.Insert(Excel.XlInsertShiftDirection.xlShiftToRight, Type.Missing); } else { rng.Worksheet.get_Range(((Excel.Range)rng.get_Item(1, rng.Columns.Count)).get_Offset(0, 1).EntireColumn, ((Excel.Range)rng.get_Item(1, rng.Columns.Count)).get_Offset(0, 2).EntireColumn).Insert(Excel.XlInsertShiftDirection.xlShiftToRight, Type.Missing); } //ManualResetEvent[] doneEvents = new ManualResetEvent[rng.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell, Type.Missing).Row]; int lastRow = rng.Worksheet.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell, Type.Missing).Row; for (int i = 1; i <= rng.Rows.Count && ((Excel.Range)rng.get_Item(i, 1)).Row <= lastRow; i++) { //doneEvents[i - 1] = new ManualResetEvent(false); RowConverter rowConverter = new RowConverter(rng, i, this.From_dropDown.SelectedItem.Label, this.To_dropDown.SelectedItem.Label); //, doneEvents[i - 1]); rowConverter.convertRow(); //new Thread(new ThreadStart(rowConverter.convertRow)).Start(); //ThreadPool.QueueUserWorkItem(rowConverter.ThreadPoolCallback, i); } //foreach (ManualResetEvent handle in doneEvents) //{ // handle.WaitOne(); //} //WaitHandle.WaitAll(doneEvents); // Autofit Cells if (this.To_dropDown.SelectedItemIndex < 1) { ((Excel.Range)rng.get_Item(1, rng.Columns.Count)).get_Offset(0, 1).EntireColumn.AutoFit(); } else { rng.Worksheet.get_Range(((Excel.Range)rng.get_Item(1, rng.Columns.Count)).get_Offset(0, 1).EntireColumn, ((Excel.Range)rng.get_Item(1, rng.Columns.Count)).get_Offset(0, 2).EntireColumn).AutoFit(); } } else { MessageBox.Show("Invalid Selection!"); } } else { MessageBox.Show("You must select a worksheet range."); } }
public LogGrid() { m_conv = new RowConverter(this); AutoGenerateColumns = false; EnableRowVirtualization = true; EnableColumnVirtualization = true; GridLinesVisibility = DataGridGridLinesVisibility.None; HeadersVisibility = DataGridHeadersVisibility.None; }
public void T_02_Manual() { var BYTES1 = new byte[] { 0x00, 0x79, 0x14 }; var row = new RowA { String1 = "Mudaker", String2 = null, Date1 = new DateTime(1980, 07, 12, 10, 10, 10, DateTimeKind.Utc), Date2 = null, Bool1 = true, Bool2 = null, Guid1 = new Guid("{9195F7DB-FE21-4BB2-B006-2496F4E24D14}"), Guid2 = null, Gdid1 = new GDID(0, 12345), Gdid2 = null, Float1 = 127.0123f, Float2 = null, Double1 = 122345.012d, Double2 = null, Decimal1 = 1234567.098M, Decimal2 = null, Amount1 = new Amount("din", 123.11M), Amount2 = null, Bytes1 = BYTES1, Bytes2 = null, ETest1 = 0, EFlags1 = 0, ETest2 = null, EFlags2 = null }; var rc = new RowConverter(); var docOriginal = rc.RowToBSONDocument(row, "A"); var doc = fullCopy(docOriginal); Console.WriteLine(doc.ToString()); var row2 = new RowA(); rc.BSONDocumentToRow(doc, row2, "A"); Assert.AreEqual("Mudaker", row2.String1); Assert.IsNull(row2.String2); Assert.IsTrue(row2.Bool1); Assert.IsNull(row2.Bool2); Assert.AreEqual(new Guid("{9195F7DB-FE21-4BB2-B006-2496F4E24D14}"), row2.Guid1); Assert.IsNull(row2.Guid2); Assert.AreEqual(new GDID(0, 12345), row2.Gdid1); Assert.IsNull(row2.Gdid2); Assert.AreEqual(127.0123f, row2.Float1); Assert.IsNull(row2.Float2); Assert.AreEqual(122345.012d, row2.Double1); Assert.IsNull(row2.Double2); Assert.AreEqual(1234567.098M, row2.Decimal1); Assert.IsNull(row2.Decimal2); Assert.AreEqual(new Amount("din", 123.11M), row2.Amount1); Assert.IsNull(row2.Amount2); Assert.NotNull(row2.Bytes1); Assert.IsTrue(BYTES1.SequenceEqual(row2.Bytes1)); Assert.IsNull(row2.Bytes2); Assert.AreEqual(0, (int)row2.ETest1); Assert.AreEqual(0, (int)row2.EFlags1); Assert.IsNull(row2.ETest2); Assert.IsNull(row2.EFlags2); }
public void T_01_Equals() { var BIN = new byte[] { 0x00, 0x79, 0x14 }; var row = new RowA { String1 = "Mudaker", String2 = null, Date1 = new DateTime(1980, 07, 12), Date2 = null, Bool1 = true, Bool2 = null, Guid1 = new Guid("{9195F7DB-FE21-4BB2-B006-2496F4E24D14}"), Guid2 = null, Gdid1 = new GDID(0, 12345), Gdid2 = null, Float1 = 127.0123f, Float2 = null, Double1 = 122345.012d, Double2 = null, Decimal1 = 1234567.098M, Decimal2 = null, Amount1 = new Amount("din", 123.11M), Amount2 = null, Bytes1 = BIN, Bytes2 = null, Byte1 = 23, SByte1 = -3, Short1 = -32761, UShort1 = 65535, Int1 = 4324, Uint1 = 42345, Long1 = 993, ULong1 = 8829383762, Byte2 = null, SByte2 = null, Short2 = null, UShort2 = null, Int2 = null, Uint2 = null, Long2 = null, ULong2 = null }; var rc = new RowConverter(); var docOriginal = rc.RowToBSONDocument(row, "A"); var doc = fullCopy(docOriginal); Console.WriteLine(doc.ToString()); Assert.IsTrue(BIN.SequenceEqual((byte[])doc["Bytes1"])); Assert.IsTrue(doc["Bytes2"] is global::MongoDB.Bson.BsonNull); var row2 = new RowA(); rc.BSONDocumentToRow(doc, row2, "A"); Assert.IsTrue(row.Equals(row2)); Assert.IsTrue(BIN.SequenceEqual(row2.Bytes1)); Assert.IsNull(row2.Bytes2); Assert.IsFalse(object.ReferenceEquals(BIN, row2.Bytes1)); }
public void T_03_Manual_wo_NULLs() { var BYTES1 = new byte[] {}; var BYTES2 = new byte[] { 0x00, 0x79, 0x14 }; var row = new RowA { String1 = "Mudaker", String2 = "Kapernik", Date1 = new DateTime(1980, 07, 12, 1, 2, 3, DateTimeKind.Utc), Date2 = new DateTime(1680, 12, 11, 5, 6, 7, DateTimeKind.Utc), Bool1 = false, Bool2 = true, Guid1 = new Guid("{9195F7DB-FE21-4BB2-B006-2496F4E24D14}"), Guid2 = new Guid("{BABACACA-FE21-4BB2-B006-2496F4E24D14}"), Gdid1 = new GDID(3, 12345), Gdid2 = new GDID(4, 1212345), Float1 = 127.0123f, Float2 = -0.123f, Double1 = 122345.012d, Double2 = -12345.11f, Decimal1 = 1234567.098M, Decimal2 = 22m, Amount1 = new Amount("din", 123.11M), Amount2 = new Amount("din", 8901234567890.012M), Bytes1 = BYTES1, Bytes2 = BYTES2, ETest1 = ETest.One, EFlags1 = EFlags.First, ETest2 = ETest.Two, EFlags2 = EFlags.Second | EFlags.Third }; var rc = new RowConverter(); var doc = rc.RowToBSONDocument(row, "A"); Console.WriteLine(doc.ToString()); var row2 = new RowA(); rc.BSONDocumentToRow(doc, row2, "A"); Assert.AreEqual("Mudaker", row2.String1); Assert.AreEqual("Kapernik", row2.String2); Assert.IsFalse(row2.Bool1); Assert.IsTrue(row2.Bool2.Value); Assert.AreEqual(new Guid("{9195F7DB-FE21-4BB2-B006-2496F4E24D14}"), row2.Guid1); Assert.AreEqual(new Guid("{BABACACA-FE21-4BB2-B006-2496F4E24D14}"), row2.Guid2); Assert.AreEqual(new GDID(3, 12345), row2.Gdid1); Assert.AreEqual(new GDID(4, 1212345), row2.Gdid2); Assert.AreEqual(127.0123f, row2.Float1); Assert.AreEqual(-0.123f, row2.Float2); Assert.AreEqual(122345.012d, row2.Double1); Assert.AreEqual(-12345.11f, row2.Double2); Assert.AreEqual(1234567.098M, row2.Decimal1); Assert.AreEqual(22m, row2.Decimal2); Assert.AreEqual(new Amount("din", 123.11M), row2.Amount1); Assert.AreEqual(new Amount("din", 8901234567890.012M), row2.Amount2); Assert.IsTrue(BYTES1.SequenceEqual(row2.Bytes1)); Assert.IsTrue(BYTES2.SequenceEqual(row2.Bytes2)); Assert.AreEqual(ETest.One, row2.ETest1); Assert.AreEqual(EFlags.First, row2.EFlags1); Assert.AreEqual(ETest.Two, row2.ETest2); Assert.AreEqual(EFlags.Second | EFlags.Third, row2.EFlags2); }
public void RowConverter_HandlesValue_Correctly() { var columns = new List<Column>() { new Column("Value") }; var row = new Row(new List<object>() { "|" }); var converter = new RowConverter(); Assert.AreEqual('|', converter.ConvertRowToObject<NullableTestModel>(columns, row).Value); }
public ConnectionGroupRow GetGroupById(long id) { ITableRow row = this._storage.ConnectionGroupDirectory.GetRowByIdentity(id); if (row == null) { return(null); } return(RowConverter.Convert <ConnectionGroupRow>(row)); }
public LastConnectionProtocolRow GetRow(long lastConnectionId) { ITableRow row = GetRowByIdentity(lastConnectionId); if (row == null) { return(null); } return(RowConverter.Convert <LastConnectionProtocolRow>(row)); }
public void RowConverter_HandlesDBNull_WithoutCrashing() { var columns = new List<Column>() { new Column("Value") }; var row = new Row(new List<object>() { DBNull.Value }); var converter = new RowConverter(); Assert.AreEqual(null, converter.ConvertRowToObject<NullableTestModel>(columns, row).Value); }
public TemplateRow GetTemplate(long templateId) { ITableRow row = GetRowByIdentity(templateId); if (row != null) { return(RowConverter.Convert <TemplateRow>(row)); } return(null); }
public void T_11_RowCycle_DirectCycle() { var root = new RowCycle(); root.SomeInt = 1234; root.InnerRow = root; //Direct cycle var rc = new RowConverter(); var doc = rc.RowToBSONDocument(root, "A"); //exception }
public async Task <ActionResult <RowResponse> > CreateAsync([FromBody] Row row) { if (!await rowService.ValidateAsync(row)) { return(BadRequest()); } var createdRow = await rowService.CreateAsync(row); var rowResponse = RowConverter.GetRowResponse(createdRow); return(Ok(rowResponse)); }
public async Task SearchAsync() { // Arrange var table = new Table { Id = Guid.NewGuid(), DatabaseId = Guid.NewGuid(), Name = tableName, Schema = JsonConvert.SerializeObject(new BrandTableSchema { Name = StringType, Country = StringType }) }; var row1 = new Row { Id = Guid.NewGuid(), TableId = table.Id, Content = JsonConvert.SerializeObject(new BrandTableSchema { Name = row1Name, Country = row1Country }) }; var row2 = new Row { Id = Guid.NewGuid(), TableId = table.Id, Content = JsonConvert.SerializeObject(new BrandTableSchema { Name = row2Name, Country = row2Country }) }; using var context = new AzureSqlDbContext(DbContextUtilities.GetContextOptions()); await context.Rows.AddAsync(row1); await context.Rows.AddAsync(row2); await context.Tables.AddAsync(table); await context.SaveChangesAsync(); var rowService = new SqlRowService(context); // Act var result = await rowService.SearchByKeywordAsync(table.Id, searchKeyword, searchColumn); var resultResponse = result.Select(r => RowConverter.GetRowResponse(r)).ToList(); // Assert Assert.IsNotNull(resultResponse); Assert.AreEqual(1, resultResponse.Count); Assert.AreEqual(row2Name, resultResponse.FirstOrDefault().Content["name"]); }
public void T_12_RowCycle_TransitiveCycle_1() { var root = new RowCycle(); root.SomeInt = 1234; root.InnerRow = new RowCycle(); root.InnerRow.SomeInt = 567; root.InnerRow.InnerRow = root; //TRANSITIVE(via another instance) CYCLE!!!! var rc = new RowConverter(); var doc = rc.RowToBSONDocument(root, "A"); //exception }
private List <TemplateRow> GetTemplates() { List <TemplateRow> templateRows = new List <TemplateRow>(); List <ITableRow> rows = GetRows(null); foreach (ITableRow row in rows) { TemplateRow templateRow = RowConverter.Convert <TemplateRow>(row); templateRows.Add(templateRow); } return(templateRows); }
public void DeserializeFromBSON(BSONSerializer serializer, BSONDocument doc, ref object context) { Guid = doc.TryGetObjectValueOf(serializer.PKFieldName).AsGUID(Guid.Empty); True = doc.TryGetObjectValueOf(BSON_FLD_TRUE).AsBool(); False = doc.TryGetObjectValueOf(BSON_FLD_FALSE).AsBool(); CharMin = doc.TryGetObjectValueOf(BSON_FLD_CHARMIN).AsChar(); CharMax = doc.TryGetObjectValueOf(BSON_FLD_CHARMAX).AsChar(); SByteMin = doc.TryGetObjectValueOf(BSON_FLD_SBYTEMIN).AsSByte(); SByteMax = doc.TryGetObjectValueOf(BSON_FLD_SBYTEMAX).AsSByte(); ByteMin = doc.TryGetObjectValueOf(BSON_FLD_BYTEMIN).AsByte(); ByteMax = doc.TryGetObjectValueOf(BSON_FLD_BYTEMAX).AsByte(); Int16Min = doc.TryGetObjectValueOf(BSON_FLD_INT16MIN).AsShort(); Int16Max = doc.TryGetObjectValueOf(BSON_FLD_INT16MAX).AsShort(); UInt16Min = doc.TryGetObjectValueOf(BSON_FLD_UINT16MIN).AsUShort(); UInt16Max = doc.TryGetObjectValueOf(BSON_FLD_UINT16MAX).AsUShort(); Int32Min = doc.TryGetObjectValueOf(BSON_FLD_INT32MIN).AsInt(); Int32Max = doc.TryGetObjectValueOf(BSON_FLD_INT32MAX).AsInt(); UInt32Min = doc.TryGetObjectValueOf(BSON_FLD_UINT32MIN).AsUInt(); UInt32Max = doc.TryGetObjectValueOf(BSON_FLD_UINT32MAX).AsUInt(); Int64Min = doc.TryGetObjectValueOf(BSON_FLD_INT64MIN).AsLong(); Int64Max = doc.TryGetObjectValueOf(BSON_FLD_INT64MAX).AsLong(); UInt64Min = doc.TryGetObjectValueOf(BSON_FLD_UINT64MIN).AsULong(); UInt64Max = doc.TryGetObjectValueOf(BSON_FLD_UINT64MAX).AsULong(); SingleEps = doc.TryGetObjectValueOf(BSON_FLD_SINGLEEPS).AsFloat(); SingleMin = doc.TryGetObjectValueOf(BSON_FLD_SINGLEMIN).AsFloat(); SingleMax = doc.TryGetObjectValueOf(BSON_FLD_SINGLEMAX).AsFloat(); SingleNaN = doc.TryGetObjectValueOf(BSON_FLD_SINGLENAN).AsFloat(); SinglePosInf = doc.TryGetObjectValueOf(BSON_FLD_SINGLEPOSINF).AsFloat(); SingleNegInf = doc.TryGetObjectValueOf(BSON_FLD_SINGLENEGINF).AsFloat(); DoubleEps = doc.TryGetObjectValueOf(BSON_FLD_DOUBLEEPS).AsDouble(); DoubleMin = doc.TryGetObjectValueOf(BSON_FLD_DOUBLEMIN).AsDouble(); DoubleMax = doc.TryGetObjectValueOf(BSON_FLD_DOUBLEMAX).AsDouble(); DoubleNaN = doc.TryGetObjectValueOf(BSON_FLD_DOUBLENAN).AsDouble(); DoublePosInf = doc.TryGetObjectValueOf(BSON_FLD_DOUBLEPOSINF).AsDouble(); DoubleNegInf = doc.TryGetObjectValueOf(BSON_FLD_DOUBLENEGINF).AsDouble(); DecimalMin = RowConverter.Decimal_BSONtoCLR(doc[BSON_FLD_DECIMALMIN]); DecimalMax = RowConverter.Decimal_BSONtoCLR(doc[BSON_FLD_DECIMALMAX]); DecimalZero = RowConverter.Decimal_BSONtoCLR(doc[BSON_FLD_DECIMALZERO]); DecimalOne = RowConverter.Decimal_BSONtoCLR(doc[BSON_FLD_DECIMALONE]); DecimalMOne = RowConverter.Decimal_BSONtoCLR(doc[BSON_FLD_DECIMALMONE]); DateTimeMin = doc.TryGetObjectValueOf(BSON_FLD_DATETIMEMIN).AsDateTime(); DateTimeMax = doc.TryGetObjectValueOf(BSON_FLD_DATETIMEMAX).AsDateTime(); DateTimeNow = doc.TryGetObjectValueOf(BSON_FLD_DATETIMENOW).AsDateTime(); DateTimeUtc = doc.TryGetObjectValueOf(BSON_FLD_DATETIMEUTC).AsDateTime(); TimeSpanMin = doc.TryGetObjectValueOf(BSON_FLD_TIMESPANMIN).AsTimeSpan(); TimeSpanMax = doc.TryGetObjectValueOf(BSON_FLD_TIMESPANMAX).AsTimeSpan(); StringEmpty = doc.TryGetObjectValueOf(BSON_FLD_STRINGEMPTY).AsString(); StringNull = doc.TryGetObjectValueOf(BSON_FLD_STRINGNULL).AsString(); String = doc.TryGetObjectValueOf(BSON_FLD_STRING).AsString(); }
public async Task <ActionResult <List <RowDto> > > FromJson([FromBody] List <RowDto> rows) { int pos = 1; foreach (var row in rows) { row.Pos = pos; pos++; _context.Rows.Add(RowConverter.RowConvert(row)); } await _context.SaveChangesAsync(); return(Ok(rows)); }
public void T_14_RowCycle_TransitiveCycle_3() { var root = new JSONDataMap(); root["a"] = 1; root["b"] = true; root["array"] = new JSONDataArray() { 1, 2, 3, true, true, root }; //TRANSITIVE(via another instance) CYCLE!!!! var rc = new RowConverter(); var doc = rc.ConvertCLRtoBSON(null, root, "A");//exception }
public MongoDBDataStore(string connectString, string dbName) : base(connectString, dbName) { m_QueryResolver = new QueryResolver(this); m_Converter = new RowConverter(); }
public MongoDBDataStore() : base() { m_QueryResolver = new QueryResolver(this); m_Converter = new RowConverter(); }
private BSONDocument docFromMessage(Message msg) { var doc = new BSONDocument(); var rc = new RowConverter(); doc.Set(new BSONStringElement("Guid", msg.Guid.ToString("N"))); doc.Set(new BSONStringElement("RelatedTo", msg.RelatedTo.ToString("N"))); doc.Set(new BSONStringElement("Type", msg.Type.ToString())); doc.Set(new BSONInt32Element("Source", msg.Source)); doc.Set(new BSONInt64Element("TimeStamp", msg.TimeStamp.Ticks)); doc.Set(new BSONStringElement("Host", msg.Host)); doc.Set(new BSONStringElement("From", msg.From)); doc.Set(new BSONStringElement("Topic", msg.Topic)); doc.Set(new BSONStringElement("Text", msg.Text)); doc.Set(new BSONStringElement("Parameters", msg.Parameters)); doc.Set(new BSONStringElement("Exception", msg.Exception.ToMessageWithType())); doc.Set(new BSONInt32Element("ThreadID", msg.ThreadID)); return doc; }