32 Questions

Jak
Jak
Member
392 Points
161 Posts
I'm using nlog with .netcore REST Api as: using Microsoft.Extensions.Logging; } catch (Exception ex) { Logger.LogCritical(-1, ex, string.Format("error occurred: {0}", ex.Message)); } But getting error as: An error occurred while writing to logger(s). (Input string was not in a cor ...
Views: 76
Total Answered: 1
Total Marked As Answer: 0
Posted On: 30-Sep-2020 03:26 
 
edx
edx
68 Points
24 Posts
I have two collections User { "_id" : ObjectId("5f51dac5ea43442fa419ca1f"), "name" : "John b" } Role { "_id" : ObjectId("584aaca6686860d502929b8d"), "role" : "Admin", "userId" : "5f51dac5ea43442fa419ca1f" } I want to join two collection based on the userId (in role collect ...
Views: 174
Total Answered: 2
Total Marked As Answer: 1
Posted On: 11-Sep-2020 05:35 
 
beginer
beginer
156 Points
48 Posts
Is there any way to parse or decode the bearer token i.e. jwt access token in c#. I want to get all claims in the token. I don't want to authenticate it but to get claims.
Views: 148
Total Answered: 1
Total Marked As Answer: 1
Posted On: 14-Aug-2020 05:52 
 
beginer
beginer
156 Points
48 Posts
I'm try to serialise an C# object to json by using Newtonsoft.Json.Serialization but it's returning name of properties as Pascal-case. For an example consider the following C# class: public class Person { public string FirstName { get; set; } public string LastName { get; set; } } ...
Views: 195
Total Answered: 1
Total Marked As Answer: 0
Posted On: 09-Jul-2020 00:07 
 
beginer
beginer
156 Points
48 Posts
I want to serialize enums in the serialization object as string instead of numeric value. Not like this: }, "gender": 3, "birthDate": "1980-01-01", Like this: }, "gender": "Male", "birthDate": "1980-01-01", I'm using following: using Newtonsoft.Json.Serialization; // package JsonC ...
Views: 162
Total Answered: 1
Total Marked As Answer: 0
Posted On: 08-Jul-2020 23:52 
 
Jak
Jak
Member
392 Points
161 Posts
I'm getting issue with fetching records from collection with objectId as: { "_id" : ObjectId("5c92b80036de59bd9de0639d"), "UserName" : "John" } { "_id" : ObjectId("5c92b80436de59bd9de0639e"), "UserName" : "Chris" } { "_id" : ObjectId("5c92b80936de59bd9de0639f"), "UserName" : "Larry" } { "_id" : ...
Views: 325
Total Answered: 1
Total Marked As Answer: 1
Posted On: 30-Jun-2020 23:25 
 
edx
edx
68 Points
24 Posts
I'm using mongodb.driver in .net core project. In this using following method to insert and update collections: mongoDB.GetCollection("COLLECTION_NAME").InsertOneAsync(doc); mongoDB.GetCollection("COLLECTION_NAME").ReplaceOne(filter, doc); How to get collection back after insert/update in mong ...
Views: 169
Total Answered: 0
Total Marked As Answer: 0
Posted On: 08-Jun-2020 02:35 
 
ykl
ykl
4 Points
2 Posts
I'm trying to create unit test on service method Service.GetAllUser(). Service method using IUserRepository to fetch users. I'm trying as: public class Tests { private Mock<IUserRepository> _userRepository; private IService _service; [SetUp] public void Setup() { ...
Views: 197
Total Answered: 2
Total Marked As Answer: 1
Posted On: 05-Jun-2020 20:43 
 
kikme
kikme
32 Points
11 Posts
In asp.net core api application, we have base controller from where all application's controllers inherited. And in base controller overriding onActionExecuting method. On the basis of few condition, want to throw exception and that can be handle from action or any global middle-ware: public clas ...
Views: 214
Total Answered: 2
Total Marked As Answer: 0
Posted On: 16-May-2020 06:03 
 
edx
edx
68 Points
24 Posts
I have .netcore rest api application with NLog logging mechanism. And working fine to file, email. But now, I'm trying to ship to logz.io as mentioned in: https://docs.logz.io/shipping/log-sources/dotnet.html. NLog config: <?xml version="1.0" encoding="utf-8" ?> <nlog xmlns="http://www ...
Views: 244
Total Answered: 2
Total Marked As Answer: 1
Posted On: 06-May-2020 00:52 
 
 Log In to Chat