You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A .NET 10 class library that provides shared MongoDB models, services, and configuration options for the Dotnet_Server back-end of the BuyingLibrary cable-shop platform.
usingBuyingLibrary.AppSettings;usingBuyingLibrary.Contexts;// Bind configuration sectionsbuilder.Services.Configure<DataBaseOptions>(builder.Configuration.GetSection(DataBaseOptions.DataBaseSettings));builder.Services.Configure<ConnectionStringsOptions>(builder.Configuration.GetSection(ConnectionStringsOptions.ConnectionStrings));builder.Services.Configure<MailOptions>(builder.Configuration.GetSection(MailOptions.EmailSettings));// Register the MongoDB context (singleton – one connection pool per process)builder.Services.AddSingleton<MongoContext>();// Register services (add only the ones you need)builder.Services.AddScoped<IService<Buy>,BuyingService>();builder.Services.AddScoped<IService<Client>,ClientService>();builder.Services.AddScoped<IService<Coil>,CoilService>();builder.Services.AddScoped<IService<Connector>,ConnectorService>();builder.Services.AddScoped<IService<Order>,OrderService>();builder.Services.AddScoped<IService<BsonDocument>,PriceService>();builder.Services.AddScoped<ImageService>();builder.Services.AddScoped<DeserAction>();
Services reference
Service
Collection
Notes
BuyingService
buys
GetAsync() returns only non-custom buys
ClientService
clients
PostAsync is idempotent — returns existing client if e-mail matches
CoilService
coils
Full CRUD
ConnectorService
connectors
Full CRUD
OrderService
orders
Extra methods: GetByClientAsync, GetByClientAndOrderAsync
PriceService
prices
Returns raw BsonDocument; use DeserAction to resolve the item
ImageService
GridFS imagestore
GetAllAsync loads all images into memory; GetOneAsync streams to a Stream
Configuration options reference
DataBaseOptions (DataBaseSettings)
Property
Type
Description
DataBaseConnection
string
MongoDB connection string
DataBase
string
Database name
ConnectionStringsOptions (ConnectionStrings)
Property
Type
Description
AppUrl
string
URL the server listens on
ClientUrl
string
Front-end origin used for CORS
MailOptions (EmailSettings)
Property
Type
Description
Email
string
Sender address
Password
string
SMTP password
Host
string
SMTP hostname
Port
int
SMTP port (e.g. 587)
Name
string
Display name in From header
Stack
Technology
Version
C#
13 (latest)
.NET
10 LTS
MongoDB.Driver
3.8
Microsoft.Extensions.*
10.0
Known limitations / roadmap
Wire and WireBuy are placeholder models for a future fully-assembled cable catalogue feature.
ImageService.GetAllAsync downloads all images into memory at once. For large catalogues, a streaming/pagination approach should be added.
No unit tests yet — a test project targeting xUnit is planned.