https://github.com/tkellogg/cortez
A fast object-to-object mapper that can generate Linq queries
https://github.com/tkellogg/cortez
Last synced: about 2 months ago
JSON representation
A fast object-to-object mapper that can generate Linq queries
- Host: GitHub
- URL: https://github.com/tkellogg/cortez
- Owner: tkellogg
- Created: 2013-01-09T06:53:52.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2013-01-14T01:05:54.000Z (over 13 years ago)
- Last Synced: 2025-01-28T09:45:10.785Z (over 1 year ago)
- Language: C#
- Size: 1.22 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
The LINQ Fast & Friendly Object-To-Object Mapper
================================================
Cortez is as fast as it gets for object-to-object mappers. It uses the
Expression tree enhancements from .NET 4.0 to generate functions
to map one object to another.
```csharp
var viewModel = Mapper.Instance.Map(existingUser);
```
LINQ to Databases
-----------------
Calling Cortez an _"Object to Object"_ mapper is a bit of a misnomer since
the source doesn't have to be an object. Since mappings are generated from
Expression trees, you can also retrieve just the expression tree, which
makes Cortez _really_ convenient to use with LINQ.
```csharp
// UserViewModel is populated directly from the database, no user object is instantiated.
var viewModels = usersDataSource.AsQueryable()
.Where(u => u.Name == "Jack")
.Select(Mapper.Instance.GetExpression())
.ToList();
```
Installing Cortez
------------
It's a single file, just [download it here][1] and include it in your
project.
[1]: https://github.com/tkellogg/Cortez/blob/master/Cortez/Mapper.cs