Jerrycurl
High-performance ORM powered by MVC and Razor SQL
Open source and free for .NET and Visual Studio
Relation
Model
[Table]
class Blog
{
[Key, Id]
public int Id { get; set; }
public string Title { get; set; }
public DateTime CreatedOn { get; set; }
}
Command
Query
View
@model Blog
@foreach (var b in M.Vals())
{
INSERT INTO @b.TblName()
( @b.In().ColNames() )
VALUES ( @b.In().Pars() );
}
@result Blog
@model DateTime
SELECT @R.Star()
FROM @R.Tbl()
WHERE @R.Col(m => m.CreatedOn) >= @M.Par()
ORDER BY @R.Col(m => m.CreatedOn) DESC
Accessor
Controller
class BlogsAccessor : Accessor
{
public Task<IList<Blog>> GetBlogs(DateTime minDate)
=> this.QueryAsync<Blog>(model: minDate);
public Task InsertBlogs(IList<Blog> newBlogs)
=> this.ExecuteAsync(model: newBlogs);
}