Should my Azure DocumentDB document classes inherit from Microsoft.Azure.Documents.Document?
By : krempelj
Date : March 29 2020, 07:55 AM
around this issue This behavior is attributed to how JSON.NET deals with properties on dynamic objects. It effectively ignores them unless you decorate them with the JsonProperty attribute. You can either work with plain POCO or you can extend from Resource (shown below), which is a static object that Document itself extends. code :
public class Person: Microsoft.Azure.Documents.Resource
{
public string Name;
public int Age;
}
|
`context.document.body.insertOoxml` breaks documents, crashes word
By : digDeep
Date : March 29 2020, 07:55 AM
like below fixes the issue I verified with the newer build that Word does not crash, but an extra empty paragraph is indeed added. This bug was resolved yesterday and the fix will be available in the next month. !
|
Microsoft.Azure.Documents.BadRequestException: ResourceType Document is unexpected
By : user2854612
Date : March 29 2020, 07:55 AM
this one helps. I am trying to update a specific product in my database.I pass the product value from body and replace it .here my partition key is catlog id.blow i give alll my code example please tell me what did i wrong? , I finally did like blow: code :
public async Task<Catalog> UpdateProductIdAsync(
Guid productid,
Product productData)
{
var feedOptions =
new FeedOptions
{
MaxItemCount = -1,
EnableCrossPartitionQuery = true
};
var query =
$"SELECT catalog.id,catalog.VendorName,catalog.Industy FROM catalog join industry in catalog.Industy join category in industry.Category join product in category.Subcategory.Product where product.Id ='" + productid + "'";
var catlog = _cosmosClient.CreateDocumentQuery<Catalog>(UriFactory.CreateDocumentCollectionUri(
_azureCosmosDbOptions.Value.DatabaseId, "catalog"), query, feedOptions).AsEnumerable().FirstOrDefault();
if (catlog != null)
{
foreach (var item in catlog.Industy)
{
foreach (var cat in item.Category)
{
Product product = cat.Subcategory.Product.FirstOrDefault(p => p.Id == productid);
if (product != null)
{
product.Name = productData.Name == null ? product.Name : productData.Name;
product.Addons = productData.Addons == null ? product.Addons : productData.Addons;
product.CurrentQuantity = productData.CurrentQuantity == null ? product.CurrentQuantity : productData.CurrentQuantity;
product.MethodOfPreparation = productData.MethodOfPreparation == null ? product.MethodOfPreparation : productData.MethodOfPreparation;
product.Price = productData.Price == null ? product.Price : productData.Price;
product.Tag = productData.Tag == null ? product.Tag : productData.Tag;
product.Unit = productData.Unit == null ? product.Unit : productData.Unit;
product.hasMethodOfPreparation = productData.hasMethodOfPreparation == false ? product.hasMethodOfPreparation : productData.hasMethodOfPreparation;
break;
}
}
break;
}
}
var requestOptions =
new RequestOptions
{
PartitionKey = new Microsoft.Azure.Documents.PartitionKey(catlog.Id.ToString())
};
var orderDocument = await _cosmosClient.ReplaceDocumentAsync(
UriFactory.CreateDocumentUri(
_azureCosmosDbOptions.Value.DatabaseId, "catalog", catlog.Id.ToString()), catlog, requestOptions);
return
(Catalog)((dynamic)catlog);
}
|
Microsoft Edge is returning different values than Chrome when document.getSelection() is called
By : user2885579
Date : March 29 2020, 07:55 AM
I wish this help you You did not posted any sample code so we are not sure how you are trying to get selection in your code. I try to make a test with code below in MS Edge and looks like it is working fine. code :
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function GetSelectedText () {
if (document.getSelection) { // all browsers, except IE before version 9
var sel = document.getSelection ();
// sel is a string in Firefox and Opera,
// and a selectionRange object in Google Chrome, Safari and IE from version 9
// the alert method displays the result of the toString method of the passed object
alert (sel);
}
else {
if (document.selection) { // Internet Explorer before version 9
var textRange = document.selection.createRange ();
alert (textRange.text);
}
}
}
</script>
</head>
<body>
<div>Please select <b>all</b> or a <i>part</i> of this text.</div>
<br />
<button onclick="GetSelectedText ()">Get selected text!</button>
</body>
</html>
|
Microsoft edge browser crashes the JS engine on regex replace
By : Ramasubramanian
Date : March 29 2020, 07:55 AM
wish help you to fix your issue If I run the regex without the u Unicode flag no timeout or crash happens in Edge (or any other major browser): code :
var foo = "Change or cancel my flight booking";
var match = "a";
console.log(foo.replace(new RegExp(match + "(?!([^<]+)?>)", 'g'), '<span class="text-highlight">${match}</span>'));
|