Skip to content
This repository has been archived by the owner on Sep 23, 2021. It is now read-only.
/ entity-net Public archive

A simple experiment prototyping a concept for strongly typed ORMs.

License

Notifications You must be signed in to change notification settings

jrbeverly/entity-net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Entity.NET Concept

Summary

A simple experiment prototyping a concept for strongly typed ORMs.

Getting Started

The idea that Entity.NET is attempting to conceptualize is one where strongly-typed objects are used with an ORM system. The primary objective is to use strongly typed identifiers (Keys.Customer) that restricts the usages of an applications ORM. The concept is from the following scenario:

var cust = new Models.Customer() { Name = "John Doe" };
var entity = Repository.Add(cust);
//entity.Key => underlying int (10)
Repository.Update(entity.Key, new Models.Customer() { Name = "David Smith" });

//...

var existing = (Keys.Customer)10;
var updatedCust = Repository.Find(entity.Key);
Console.WriteLine(updatedCust.Name); //David Smith

The code would be generated from the base definition of an entity below. Roslyn would generate the strongly-typed code using Attributes on the models to control the code outputs.

[Entity(typeof(int))]
class Customer {
    public string Name { get; set; }
    public string Address { get; set; }
}

Acknowledgements

The project icon is retrieved from the Noun Project. The original source material has been altered for the purposes of the project. The icon is used under the terms of the Public Domain.

The project icon is by Maxi Koichi from the Noun Project.