Selecting an OR Mapper
it's hard work selecting which OR mapper to use, these are a few steps to help select the appropriate mapper
- Easy to use and read.
1: UserEntity entity = new UserEntity();
2: entity.FirstName = "Amir";
3: entity.LastName = "Magdy";
4: entity.Password = PasswordHash;
5: entity.Save();
- No strings used to refrence object names.
1: new TransactionCollection()
2: .GetMulti(TransactionFields.DateOfTransaction > DateTime.Now.AddDays(-1));
as you can see in the previous code DateOfTransaction is the field name which refrences the original field name in database and also the previous code checks for the type of the field and would break with a compile error if both sides of the expression are the same type this is done by overloading the operator ">"
- Expressions are combinable
1: ISortExpression sort = new SortBLOCKED EXPRESSION;
2: sort.Add(SubCategoryFields.Name | SortOperator.Ascending);
3: sort.Add(SubCategoryFields.OldId | SortOperator.Descending);
you can combine expressions and in filters you can combine with and and with orRelatated objects are mapped in code and are easily accessed.
- Related objects are mapped through objects
1: txtManagerName.Text = DepartmentEntity.Employees[0].FullName;
when there's a relationship defined in your database it maps related objects in your database
- Lazyloading, Prefetch
resulting code should only access database only when needed to do this and gets the least amount of data needed but at the same time you can also do the opposite and prefetch a lot of records for binding with less database round trips
- Transactional Support
a simple way of creating and enrolling objects in a transaction is needed and isolation level change must be exposed in generated code
- Mapping Stored Procedures and functions
mapping other database objects like stored proceudures and accessing results in typed objects
sample code here is used from generated code by llblgenpro.com