Skip to content

Infrastructure for backend in C# .Net - Dynamic mapping using reflection, low code ORM, etc

Notifications You must be signed in to change notification settings

BinaryMasc/Dalion.DDD.Infrastructure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dalion.DDD.Infrastructure

Build Status

About

Infrastructure for backend in C# .Net - Dynamic mapping using reflection, low code ORM, etc.

Query to SQL

//  Declare a QueryGenericHandler<T> Object
var usr = new User(); //    In this example we can use User class
var query = new QueryGenericHandler<User>(usr);

//  Set wheres and other filters
query.Where(u => u.Username == "UserTest" && u.IsActive);

//  Then execute the query
var result = await query.RunQuery()?[0];    //  Get the first result

The QueryGenericHandler object build a query use the name of the class and its fields to build a query, assuming a table or view exists that matches the class and its fields and will automatically be mapped at runtime.

Command Insert

//  User model example
User usr = new User
{
    Username = "UserFromApi",
    Email = "userfromApi@yahoo.cool",
    Name = "Big",
    LastName = "Mom",
    Profession = "dev",
    IsActive = true,
    IsBlocked = false,
};
var cmd = new CommandGenericHandler<User>(usr);
//  Insert to the User table
await cmd.RunInsert(usr);

Configure ConnectionString

//	On startup.cs
SQLConnection.SetConnectionString("Server=localhost;Database=DalionDev;Integrated Security=SSPI");

License

MIT

Free Software, Hell Yeah!

About

Infrastructure for backend in C# .Net - Dynamic mapping using reflection, low code ORM, etc

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages