Advanced Search
Search Results
261 total results found
Object Ids
Every object is uniquely identifiable, by a standardized UUIDv7. This datatype works across MSSQL, PostgreSQL, SQLite, and Typescript/JavaScript (as string). In Service and Storage In API, services, and backend storage, an object's ID is created as an UUIDv...
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 ...
Net Core DI Truths
References: NET Core DI Best Practices Here’s a list of behaviors of the NET Core DI registry: All dynamic access to services (from DI) are requested through a service provider.This is what people call a service locator. For example:var foosvc = _servic...
IServiceProvider vs IServiceScopeFactory
References: Net Core DI Truths Internet’s Claim of Anti-Patterns Contrary to what the internet says about service locator usage as anti-pattern, there will always be the need for logic to dynamically access services from DI.This is because the NET Core runti...
How to Create IOptions Instance
It’s pretty standard for classes to require configuration in their constructors in the IOptions form.But, this doesn’t make testing very easy. Here’s a workaround for pushing an IOptions instance into a class constructor, that needs config. This example is f...
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 - DataContext Attributes
When creating a provider-scoped data context (one for a specific backend), you need to decorate the type with a DataContextAttribute. This allows application code, to easily identify the provider-specific data contexts, to use for a particular backend choice....
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...
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...
Type Registry Helper
TypeRegistryHelper
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...
EF: Derived Stored Types
If you want to create an entity type that happens to derive from another entity type, JUST TO simplify the codebase, then you may run into this problem. For example: We have a type Widget: public class DOWidget_v1 : DomainBase_v1 { public string Name {...
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...
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...
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: 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...
How to Stop Cell HotSpot Throttling
Here's a simple thing to do, to get around hotspot throttling when tethered to a phone. What's happening is that your cell provider is watching the TTL value of packets coming to the cell tower, and looking for ones that have hopped through your cell phone (a...