Camster
Camster
CC#
Created by GlitchYourDevice on 6/17/2024 in #help
insert mac addresses into a table of sqlite db
You could probably write a sql query to generate all the address in a temp table and insert them at the end. Can even do it in batches
12 replies
CC#
Created by Camster on 5/17/2024 in #help
EF Core Loses Decimal Precision After Save
Appreciate the help, thanks πŸ™‚
19 replies
CC#
Created by Camster on 5/17/2024 in #help
EF Core Loses Decimal Precision After Save
Hmnm, I'm not sure that will work for me. Mine is database-first. I'm not sure how to implement this change
19 replies
CC#
Created by Camster on 5/17/2024 in #help
EF Core Loses Decimal Precision After Save
I'm finally settling down from a busy morning. I'll take a look at this, thank you!
19 replies
CC#
Created by Camster on 5/17/2024 in #help
EF Core Loses Decimal Precision After Save
actually, I have to head out, I'm super tired. Thanks for your help, maybe tomorrow I'll find something
19 replies
CC#
Created by Camster on 5/17/2024 in #help
EF Core Loses Decimal Precision After Save
I have to step away for a bit, kids need help
19 replies
CC#
Created by Camster on 5/17/2024 in #help
EF Core Loses Decimal Precision After Save
I have a Mapper class where I can override it if I have to, so it wouuldn't be too big of a deal to do it manually. Just wanted to check in case there was something already out there that does it
19 replies
CC#
Created by Camster on 5/17/2024 in #help
EF Core Loses Decimal Precision After Save
19 replies
CC#
Created by Camster on 5/17/2024 in #help
EF Core Loses Decimal Precision After Save
decimal
19 replies
CC#
Created by Camster on 5/17/2024 in #help
EF Core Loses Decimal Precision After Save
I think it does?
19 replies
CC#
Created by Camster on 5/17/2024 in #help
EF Core Loses Decimal Precision After Save
19 replies
CC#
Created by Camster on 5/17/2024 in #help
EF Core Loses Decimal Precision After Save
It's a database first approach, but lemme check
19 replies
CC#
Created by Camster on 4/18/2024 in #help
βœ… IMemoryCache missing Contains?
Thank you for your help πŸ™‚
12 replies
CC#
Created by Camster on 4/18/2024 in #help
βœ… IMemoryCache missing Contains?
I see what you mean. I was confused because when I google it, everything says "just use contains", but I can't find contains. Nonetheless, I think I can see how I can just use TryGetValue or GetOrCreate to do what needs to be done. I suppose that check isn't necessary
12 replies
CC#
Created by Camster on 4/18/2024 in #help
βœ… IMemoryCache missing Contains?
Okay, cool. Funny, I'm using MemoryCach to store ConcurrentDictionaries πŸ˜„
12 replies
CC#
Created by Camster on 4/18/2024 in #help
βœ… IMemoryCache missing Contains?
True, I suppose I could do that. Doesn't seem very efficient, but that would work
12 replies
CC#
Created by Camster on 2/29/2024 in #help
βœ… MediatR Pipeline where TResponse has a generic type
3 replies
CC#
Created by Camster on 2/29/2024 in #help
βœ… MediatR Pipeline where TResponse has a generic type
I want to use MediatR's pipeline to log exceptions to a separate database. But I'm not quite sure how to add a third generic type to the IPipelineBehavior. I tried this:
// Without response object
public class ExceptionPipeline<TRequest, TResponse> : IPipelineBehavior<TRequest, Result>
{
private IExceptionHandler _handler;

public ExceptionPipeline(IExceptionHandler handler)
{
_handler = handler;
}

public async Task<Result> Handle(TRequest request, RequestHandlerDelegate<Result> next, CancellationToken cancellationToken)
{
Result response;
try
{
response = await next();
} catch (Exception ex)
{
var message = await _handler.LogException(ex);
response = Result.Failure(message);
}
return response;
}
}

// With response object
public class ExceptionPipeline<TRequest, TResponse, TResult> : IPipelineBehavior<TRequest, Result<TResult>>
{
private IExceptionHandler _handler;

public ExceptionPipeline(IExceptionHandler handler)
{
_handler = handler;
}

public async Task<Result<TResult>> Handle(TRequest request, RequestHandlerDelegate<Result<TResult>> next, CancellationToken cancellationToken)
{
Result<TResult> response;
try
{
response = await next();
} catch (Exception ex)
{
var message = await _handler.LogException(ex);
response = Result<TResult>.Failure(message);
}
return response;
}
}
// Without response object
public class ExceptionPipeline<TRequest, TResponse> : IPipelineBehavior<TRequest, Result>
{
private IExceptionHandler _handler;

public ExceptionPipeline(IExceptionHandler handler)
{
_handler = handler;
}

public async Task<Result> Handle(TRequest request, RequestHandlerDelegate<Result> next, CancellationToken cancellationToken)
{
Result response;
try
{
response = await next();
} catch (Exception ex)
{
var message = await _handler.LogException(ex);
response = Result.Failure(message);
}
return response;
}
}

// With response object
public class ExceptionPipeline<TRequest, TResponse, TResult> : IPipelineBehavior<TRequest, Result<TResult>>
{
private IExceptionHandler _handler;

public ExceptionPipeline(IExceptionHandler handler)
{
_handler = handler;
}

public async Task<Result<TResult>> Handle(TRequest request, RequestHandlerDelegate<Result<TResult>> next, CancellationToken cancellationToken)
{
Result<TResult> response;
try
{
response = await next();
} catch (Exception ex)
{
var message = await _handler.LogException(ex);
response = Result<TResult>.Failure(message);
}
return response;
}
}
But I get an error that basically says the implementation Type can't be converted to the service type. Any help would be appreciated!
3 replies
CC#
Created by Camster on 2/19/2024 in #help
MediatR in Class Library
Excellent. It’s all becoming clear to me now. Thank you 😊
22 replies
CC#
Created by Camster on 2/19/2024 in #help
MediatR in Class Library
You mean, by using MediatR’s request/response and notification systems, MediatR will handle any surplus injections?
22 replies