Advanced Search
Search Results
78 total results found
HowTo Access DI Services
NOTE: If you are looking for how to generate an instance of ServiceProvider, outside of NET Core runtime, like for a unit test, see this: Duplicating .NET Core DI Here’s a good reference on how DI scoping works: The dangers and gotchas of using scoped service...
HowTo Make .Net Desktop App DPI Aware
For a better desktop UI experience, it is necessary to have access to the current screen size and pixel density of the display (DPI), so that an application controls and text fonts can be adjusted as needed for good layout and presentation. Here is a list of ...
Unit Tests with PostgreSQL Backends
In order to easily stand up a Postgres database for unit and integration testing, we need a class that can encapsulate the effort, to an easy call surface. Below we have a helper class that will manage the life-cycle of a test database, in PostgreSQL. Given ...
EF - Backend vs .NET Datatypes
Here's a list of what datatypes that Entity Framework uses to store .NET datatypes in a couple different database engines. .NET Datatype SQL Server PostgreSQL SQLite Comments bool bit boolean INTEGER byte tinyint smallint (Postgr...
Unit Testing Conventions
Suppress Async Warning Project-Wide Since we have several calls to base classes for diagnostics and such that are async, it's a good idea to standardize on all Test methods be async. The problem is that not every test method contains an awaited call. so, we ...
Using Visual Studio with Git
Visual Studio brings in lots of files and folders that don't belong in a checked in repository. Here's a good gitignore file for Visual Studio projects: # This works in Visual Studio projects # to ignore most VS generated output. # NOTE: It does not work...
Base Domain Type
Here are notes about the base domain type, its usage, and design choices. NOTE: Some of these are restrictions of the C# compiler, that makes it necessary to include some boilerplate in domain objects. Design Requirements Here are design requirements for ou...
Example Derived Type
Here's a working example of a domain type that derives from the base type in this page: Base Domain Type /// <summary> /// This is a sample domain type that uses our base type. /// It is only for testing. /// For this type to exist, it requ...
RabbitMQ Cloud Service RPC Conventions
Here’s a list of conventions followed by cloud services for inter-service RPC communication. RPC, being a request-response type of comms, like a REST call (request and response), requires some a standardized convention when implemented over an async queue tra...
RMQ Scenarios
Change Events A service that needs to publish change events for a domain. An example of this would be a security directory that receives a change request for a user account, to change its username. This update would need to be propagated to other services th...
OGA.PostGres.Lib Usage
Here’s notes on how to create and manage databases with OGA.PostGres.Lib. This applies to use cases for: Standing up a temporary database for unit and integration testing. Creating live database tables with compatible column types for storing class ...
EF: Logging
Here's some notes on how we implement logging in EF. We've currently implemented it in our dynamic domain dbcontext, DynamicDbContext. To make it work, we just have to create an instance of DbContextLoggingConfig, and pass it to our top-level dbcontext const...
EF: Data Contexts - DbContexts
When working in EF, you will come across the need to create a DbContext type. MS has a base class that you inherit from, called: DbContext. It is useful to implement either a two or three layer DbContext. See this page for EF Logging implementation: EF: Log...
Mocking a DBContext for Testing
The easiest means to mock a data context for testing, is to use an in-memory database. An in-memory database is known by its string-name within a process. Each data context accessing the database instance must use its name, via options. See this page for EF ...
VS Library - csproj Contents
Here are some standard things for the csproj file of a .NET library project. The top Property Group should list the following things: <PropertyGroup> <TargetFramework>net6.0</TargetFramework> <PackageId>OGA.NugetRepoClient.Lib</PackageId> <P...
.NET 5 Global Using Error
If you have a project that is targeting a .NET 5, and you see the following error, follow this page: The error indicates that your csproj file likely has a statement that only works in .NET6 (C# v10) and later. Open your csproj file and look for a statemen...
Create Nuget for Multiple Targets or Architectures
Creating nuget packages that contain libraries for multiple frameworks or runtimes, requires some non-trivial effort.So, this page explains the steps required. Some of this was taken from here: Non-Trivial Multi-Targeting with .NET Project Setup For multipl...
Nuget Build and Publish Scripts for Multiple Targets
Here’s a set of basic command line steps to run, to generate a nuget package for a library or an executable. NOTE: These statements are for projects that target multiple runtimes. So, they can be simplified for a single runtime or single target framework. Fo...