Infotekka.LightData 3.1.0

dotnet add package Infotekka.LightData --version 3.1.0                
NuGet\Install-Package Infotekka.LightData -Version 3.1.0                
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="Infotekka.LightData" Version="3.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Infotekka.LightData --version 3.1.0                
#r "nuget: Infotekka.LightData, 3.1.0"                
#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 Infotekka.LightData as a Cake Addin
#addin nuget:?package=Infotekka.LightData&version=3.1.0

// Install Infotekka.LightData as a Cake Tool
#tool nuget:?package=Infotekka.LightData&version=3.1.0                

Nuget Package Url

https://www.nuget.org/packages/Infotekka.LightData

Introduction

LightData is a asynchronous lightweight SQL based ORM that is designed to be used with data-first applications. It can quickly connect you to your datasource and provide fully functional models to create, read, update, and delete table data, plus execute stored procedures and retrieve results.

Getting Started

While it is possible to write your own models, there is a suggested convention to most effectively use the LightData tools. There is a built-in Model Builder which will generate code based on your database and create C# classes to match.

  1. Set up a simple C# library project (for example My.NameSpace.Project.Data, which your main application will reference. This is to separate the data access from the main application and makes testing easier.
  2. Create a complimentary test project for the new library project.
    1. Create a test class called ModelBuilder.
    2. Add a using directive for both Infotekka.LightData and Infotekka.LightData.Schema.
    3. Create a test called BuildModels.
    4. Use the methods in Infotekka.LightData.ModelBuilder to generate code models and write them to the filesystem. For example:
        string connectionString = "[Your Connection String]";
        string nameSpace = "Your.Project.Application.Data"; //This is the namespace that new models will use.
        string literalConnectionStringProperty = "Runtime.ConnectionString"; //This is literal code that will be inserted into the ConnectionString property on new models, it should reference a class and property available to all models.
        string path = "../../../../Your.Project.Application.Data"; //A path on the filesystem where the models will be written. This example is relative to the test.
    
        var tables = SchemaCore.GetTables(connectionString);
    
        foreach (var t in tables) {
            string classname = t.TableName.CapFirstVariableName();
            string fname = $"{path}/{classname}.cs";
            if (System.IO.File.Exists(fname)) { System.IO.File.Delete(fname); }
            Infotekka.CoreData.ModelBuilder.BuildModel(path, t, nameSpace, csStringMap);
        }
    
  3. Connect to and use your data. The model builder creates a class for each table, with a subclass that defines the record structure in the table. Access the data by creating an instance of the table class then calling .Load() or .LoadAsnyc() against it. Without paramters .Load() will load the entire table, however you can pass a simple lambda query in the function. For example await myTable.Load(l => l.FirstName == "James");.

Contribute

Still working on this part, find us at https://www.infotekka.com for questions and comments.

Product 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 was computed.  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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net462 is compatible.  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 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.

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
3.1.0 98 11/4/2024
3.0.0 96 11/1/2024
2.4.0.2 302 6/27/2024
2.4.0.1 260 1/31/2024
2.3.0.4 263 11/27/2023