UskokDB.MySql
2.3.2
dotnet add package UskokDB.MySql --version 2.3.2
NuGet\Install-Package UskokDB.MySql -Version 2.3.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="UskokDB.MySql" Version="2.3.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add UskokDB.MySql --version 2.3.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: UskokDB.MySql, 2.3.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install UskokDB.MySql as a Cake Addin
#addin nuget:?package=UskokDB.MySql&version=2.3.2
// Install UskokDB.MySql as a Cake Tool
#tool nuget:?package=UskokDB.MySql&version=2.3.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
UskokDB
And extension library for UskokDB
used for runtime table creating and inserting/replacing to the table, some examples:
Example
[TableName("tableName");
class Person : MySqlTable<Person>
{
public string Name { get; set; }
public string LastName { get; set; }
}
Console.WriteLine(Person.MySqlTableInitString);
//Same as above since it is a static property
Console.WriteLine(MySqlTable<Person>.MySqlTableInitString);
The resulting mysql string is
Create Table IF NOT EXISTS `tableName` (Name Text, LastName Text)
Example 2
//If no TableName attribute is found type name is used
class Person : MySqlTable<Person>
{
[Key]
public Guid Id;
[MaxLength(20)]
public string Name { get; set; }
//Unless the length is specified the
public string LastName { get; set; }
[AutoIncrement]//not how ages works but...
public int Age {get;set;}
[NotMapped]
public string FullName
{
get
{
return $"{Name} {LastName}"
}
}
}
//
Person person1 = new Person {
Id = Guid.NewGuid(),
Name = "Vuk",
LastName = "Uskokovic",
Age = 0
};
Person person2 = new Person {
Id = Guid.NewGuid(),
Name = "Vuk",
LastName = "Uskokovic",
Age = 0
};
using var connection = SomeConnectionFactory.New();
table.Insert(connection, person1);
await table.InsertAsync(connection, person2);
person1.Age = 21;//Lets say I aged 21 years
person2.Age = 22;
await table.ReplaceAsync(connection, person1);
table.Replace(connection, person2);
The resulting mysql for the table is
Create Table IF NOT EXISTS `Person` (Id VARHCAR(36) PRIMARY KEY, Name VARCHAR(20), LastName TEXT, Age INT AUTO_INCREMENT)
Example foreign key
[TableName("people")]
class Person : MySqlTable<Person>
{
[Key]
public Guid PersonKey { get; set; }
public string Name {get; set; }
}
class Child : MySqlTable<Child>
{
[ForeignKey<Person>]
public Guid ParentId { get; set; }
public string Name { get; set; }
}
The sql insert for Child type would be
CREATE TABLE IF NOT EXISTS `Child` (ParentId VARCHAR(36), Name TEXT, FOREIGN KEY (ParentId) REFERENCES people(PersonKey))
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- System.Memory (>= 4.5.5)
- UskokDB (>= 2.1.1)
-
net6.0
- UskokDB (>= 2.1.1)
-
net7.0
- UskokDB (>= 2.1.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.3.2 | 89 | 2/29/2024 |
2.3.1 | 84 | 2/28/2024 |
2.3.0 | 91 | 2/28/2024 |
2.2.0 | 138 | 8/16/2023 |
2.1.1 | 113 | 8/31/2023 |
2.1.0 | 124 | 8/7/2023 |
2.0.2 | 134 | 7/28/2023 |
2.0.1 | 128 | 7/28/2023 |
2.0.0 | 131 | 7/28/2023 |
1.9.0 | 134 | 7/19/2023 |
1.8.0 | 150 | 7/19/2023 |
1.7.0 | 190 | 4/21/2023 |
1.6.0 | 146 | 4/21/2023 |
1.5.0 | 162 | 4/21/2023 |
1.4.0 | 148 | 4/20/2023 |
1.3.0 | 164 | 4/12/2023 |
1.2.0 | 161 | 4/12/2023 |
1.1.0 | 148 | 4/10/2023 |
1.0.0 | 175 | 4/9/2023 |
Added TableInitUtil so now you can creates all tables in the code with a one liner