All Projects → jitbit → PropMapper

jitbit / PropMapper

Licence: MIT license
Object mapper for .NET. Flat and basic, but FAST.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to PropMapper

smartstruct
Dart Code Generator for generating mapper classes
Stars: ✭ 20 (-33.33%)
Mutual labels:  mapper, object-mapper
Venflow
A brand new, fast and lightweight ORM, build for PostgreSQL.
Stars: ✭ 162 (+440%)
Mutual labels:  mapper, object-mapper
Bull
BULL - Bean Utils Light Library
Stars: ✭ 150 (+400%)
Mutual labels:  mapper
polymorphia
A very fast POJO codec for MongoDB (used in conjunction with the Mongo Java Driver) that handles generic types as well as polymorphic class hierarchies
Stars: ✭ 21 (-30%)
Mutual labels:  mapper
Ngmlr
NGMLR is a long-read mapper designed to align PacBio or Oxford Nanopore (standard and ultra-long) to a reference genome with a focus on reads that span structural variations
Stars: ✭ 215 (+616.67%)
Mutual labels:  mapper
Excelmapper
Map POCO objects to Excel files
Stars: ✭ 166 (+453.33%)
Mutual labels:  mapper
Bus
Bus 是一个基础框架、服务套件,它基于Java8编写,参考、借鉴了大量已有框架、组件的设计,可以作为后端服务的开发基础中间件。代码简洁,架构清晰,非常适合学习使用。
Stars: ✭ 253 (+743.33%)
Mutual labels:  mapper
Moya Modelmapper
ModelMapper bindings for Moya.
Stars: ✭ 143 (+376.67%)
Mutual labels:  mapper
style-vendorizer
Tiny CSS vendor prefixer and property alias mapper for runtime styling solutions
Stars: ✭ 56 (+86.67%)
Mutual labels:  mapper
Batmap
🦇 Convention-based, fast object mapper.
Stars: ✭ 210 (+600%)
Mutual labels:  mapper
Swift-Viper-Weather-App
iOS app with Clean Architecture
Stars: ✭ 20 (-33.33%)
Mutual labels:  mapper
Spring Boot Seed
SpringBoot骨架项目,集成SpringBoot、Mybatis、Druid、Mapper、PageHelper、Redis、Shiro、Swagger2、Log4j2等技术
Stars: ✭ 204 (+580%)
Mutual labels:  mapper
Ormi
A Light-ORM for accesing WMI
Stars: ✭ 176 (+486.67%)
Mutual labels:  mapper
es-mvc
ESMVC 旨在方便 ElasticSearch 的使用,就行访问数据库一样访问ES,提供了方便的 service, mapper 层。底层支持 TransportClient, RestHighLevelClient 。
Stars: ✭ 20 (-33.33%)
Mutual labels:  mapper
Jmapper Core
Elegance, high performance and robustness all in one java bean mapper
Stars: ✭ 159 (+430%)
Mutual labels:  mapper
derivejs
DeriveJS is a reactive ODM - Object Document Mapper - framework, a "wrapper" around a database, that removes all the hassle of data-persistence by handling it transparently in the background, in a DRY manner.
Stars: ✭ 54 (+80%)
Mutual labels:  mapper
Okhelper Service
OK帮 云进销存 (SpringBoot Restful 全家桶)
Stars: ✭ 146 (+386.67%)
Mutual labels:  mapper
Mongodm
A golang object document mapper (ODM) for MongoDB
Stars: ✭ 178 (+493.33%)
Mutual labels:  mapper
Mapper
🔥 An Object-Object AutoMapper for TypeScript 🔥
Stars: ✭ 221 (+636.67%)
Mutual labels:  mapper
dynamo-node
DynamoDB mapper
Stars: ✭ 12 (-60%)
Mutual labels:  mapper

PropMapper

Property mapper for .NET. Flat and basic, but VERY FAST.

Just one cs-file, only 80 lines of code.

Installation

Drop the cs-file into your project OR install via Nuget

Install-Package PropMapper

(this will will simply add the .cs file to your project, not a DLL-reference, so you're free of dependencies)

Usage

Just one line of code:

//instantiating a new object
DestType destObject = PropMapper<SourceType, DestType>.From(srcObj);

or

//using with existing objects
PropMapper<SourceType, DestType>.CopyTo(srcObj, destObj);

Benchmarks

Mapping a simple object with 50 properties, over 100k iterations.

Results:

Mapper Results
Automapper 32490ms
Automapper with cached config object 335ms
PropMapper 25ms
Manual code 10ms

PropMapper is more than 13 times faster. Here's the class we tested on:

public class Tester
{
	public string prop1 { get; set; }
	public string prop2 { get; set; }
	public string prop3 { get; set; }
	public int iprop1 { get; set; }
	//etc. 50 times
}

Under the hood

We use compiled Expression trees, created in the static constructor and cached in a var, which makes it really fast.

Use case: casting base class to derived class

public class Person
{
	public string FirstName { get; set; }
	public string LastName { get; set; }
}
public class Employee : Person
{
	public string Title { get; set; }
	
	public Employee(Person person)
	{
		PropMapper<Person, Employee>.CopyTo(person, this);
	}
}

What's next?

Currently it's just one C# file, with unit tests, a proper library and more benchmarks coming later. The tool is in heavy use in other projects of ours, so it's regularly unit-tested anyway.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].