KullGames_ServerLists_DataAccess 1.0.20241028.964
dotnet add package KullGames_ServerLists_DataAccess --version 1.0.20241028.964
NuGet\Install-Package KullGames_ServerLists_DataAccess -Version 1.0.20241028.964
<PackageReference Include="KullGames_ServerLists_DataAccess" Version="1.0.20241028.964" />
paket add KullGames_ServerLists_DataAccess --version 1.0.20241028.964
#r "nuget: KullGames_ServerLists_DataAccess, 1.0.20241028.964"
// Install KullGames_ServerLists_DataAccess as a Cake Addin #addin nuget:?package=KullGames_ServerLists_DataAccess&version=1.0.20241028.964 // Install KullGames_ServerLists_DataAccess as a Cake Tool #tool nuget:?package=KullGames_ServerLists_DataAccess&version=1.0.20241028.964
KullGames_ServerLists_DataAccess Library
Overview
The KullGames_ServerLists_DataAccess
library is a .NET 8.0 data access layer designed for interacting with Minecraft server listings. It utilizes Entity Framework Core and supports multiple database providers such as MySQL, PostgreSQL, SQLite, SQL Server, Firebird, In-Memory, and Cosmos DB. The library provides an interface IDataAccess
for performing CRUD operations on Users, Servers, and ServerTags.
Features
- Multi-Database Support: Easily switch between different database providers.
- Entity Framework Core: Leverages EF Core for ORM capabilities.
- Asynchronous Operations: Fully asynchronous methods for non-blocking operations.
- Extensible: Designed to be extended or modified for additional functionalities.
- Modular Design: Separates EF models into the
KullGames_ServerLists_EfModels
project for better modularity.
Requirements
- .NET 8.0 SDK
- Visual Studio 2022 or higher (optional for development)
- Database Provider (MySQL, PostgreSQL, SQLite, etc.)
Installation
Add the library to your project by referencing it in your .csproj
file:
<ProjectReference Include="..\KullGames_ServerLists_DataAccess\KullGames_ServerLists_DataAccess.csproj" />
Ensure that you also include the KullGames_ServerLists_EfModels
project:
<ProjectReference Include="..\KullGames_ServerLists_EfModels\KullGames_ServerLists_EfModels.csproj" />
Usage
Setting up DataAccess
Create an instance of DataAccess
by providing DataAccessOptions
:
using KullGames_ServerLists_DataAccess;
using KullGames_ServerLists_EfModels;
var options = new DataAccessOptions
{
DatabaseType = DatabaseType.MySQL,
ConnectionString = "your-connection-string",
MySqlServerVersion = new MySqlServerVersion(new Version(8, 0, 21)),
ReuseContext = true
};
IDataAccess dataAccess = new DataAccess(options);
Performing CRUD Operations
Users
// Create a new user
var user = new User
{
Id = Guid.NewGuid(),
Username = "PlayerOne",
Email = "playerone@example.com"
};
await dataAccess.SaveUserAsync(user);
// Fetch a user
var fetchedUser = await dataAccess.GetUserAsync(user.Id);
// Delete a user
await dataAccess.DeleteUserAsync(user.Id);
Servers
// Create a new server
var server = new Server
{
Id = Guid.NewGuid(),
Name = "Awesome Minecraft Server",
OwnerId = user.Id,
IPAddress = "192.168.1.100",
Port = 25565
};
await dataAccess.SaveServerAsync(server);
// Fetch servers
var servers = await dataAccess.GetServersAsync(new[] { server.Id });
// Delete a server
await dataAccess.DeleteServerAsync(server.Id);
ServerTags
// Create a new server tag
var tag = new ServerTag
{
Id = Guid.NewGuid(),
TagName = "Survival"
};
await dataAccess.SaveServerTagAsync(tag);
// Fetch server tags
var tags = await dataAccess.GetServerTagsAsync(new[] { tag.Id });
// Delete a server tag
await dataAccess.DeleteServerTagAsync(tag.Id);
Supported Databases
- MySQL/MariaDB
- PostgreSQL
- SQLite
- SQL Server
- Firebird
- In-Memory Database (For testing)
- Cosmos DB
Configuration Options
DataAccessOptions
allows you to configure the data access layer:
DatabaseType
: Specifies the type of database to use.ConnectionString
: The connection string for your database.MySqlServerVersion
: Required for MySQL/MariaDB.SqliteFilePath
: File path for SQLite database.ReuseContext
: Whether to reuse the same DbContext instance.- Additional properties for specific databases like Cosmos DB.
Project Structure
- KullGames_ServerLists_DataAccess: Contains the data access layer implementation.
- KullGames_ServerLists_EfModels: Contains the Entity Framework models and
ServerListDbContext
.
Building the Project
To build the project locally:
Clone the repository:
git clone https://dev.azure.com/KullGamesRepo/KullGames/_git/KullGames_ServerLists
Navigate to the project directory:
cd KullGames_ServerLists
Restore dependencies and build:
dotnet restore dotnet build
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature
). - Commit your changes (
git commit -am 'Add some feature'
). - Push to the branch (
git push origin feature/your-feature
). - Create a pull request.
License
This project is licensed under the CC BY-NC 4.0 License - see the LICENSE file for full details.
You are free to:
- **Share**: Copy and redistribute the material in any medium or format.
- **Adapt**: Remix, transform, and build upon the material.
Under the following terms:
- **Attribution**: You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- **NonCommercial**: You may not use the material for commercial purposes.
Contact
For questions or support, please visit KullGames or open an issue in the repository.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- FirebirdSql.EntityFrameworkCore.Firebird (>= 11.0.0)
- FluentValidation (>= 11.10.0)
- KullGames_ServerLists_EfModels (>= 1.0.20241028.964)
- KullGames_ServerLists_Localization (>= 1.0.20241028.964)
- Microsoft.EntityFrameworkCore (>= 8.0.10)
- Microsoft.EntityFrameworkCore.Abstractions (>= 8.0.10)
- Microsoft.EntityFrameworkCore.Analyzers (>= 8.0.10)
- Microsoft.EntityFrameworkCore.Cosmos (>= 8.0.10)
- Microsoft.EntityFrameworkCore.InMemory (>= 8.0.10)
- Microsoft.EntityFrameworkCore.Sqlite (>= 8.0.10)
- Microsoft.EntityFrameworkCore.Sqlite.Core (>= 8.0.10)
- Microsoft.EntityFrameworkCore.SqlServer (>= 8.0.10)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 8.0.10)
- Pomelo.EntityFrameworkCore.MySql (>= 8.0.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on KullGames_ServerLists_DataAccess:
Package | Downloads |
---|---|
KullGames_ServerLists_DataAccessClient
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.20241028.964 | 86 | 10/28/2024 |
1.0.20241025.953 | 90 | 10/25/2024 |
Initial release.