Mix.Heart 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Mix.Heart --version 1.0.0
NuGet\Install-Package Mix.Heart -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Mix.Heart" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Mix.Heart --version 1.0.0
#r "nuget: Mix.Heart, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Mix.Heart as a Cake Addin
#addin nuget:?package=Mix.Heart&version=1.0.0

// Install Mix.Heart as a Cake Tool
#tool nuget:?package=Mix.Heart&version=1.0.0

Mix Heart

CodeFactor [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FMix IO%2FMix IO-Heart.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FMix IO%2FMix IO-Heart?ref=badge_shield) [![Build Status](https://travis-ci.org/Mix IO/Mix IO-Heart.svg?branch=master)](https://travis-ci.org/Mix IO/Mix IO-Heart)

License

[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FMix IO%2FMix IO-Heart.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FMix IO%2FMix IO-Heart?ref=badge_large)

Reference

https://github.com/Mix IO/Mix IO-Heart-Sample

Sample Code

Create Models

using System;

namespace SimpleBlog.Data.Blog
{
    public class Post
    {
        public string Id { get; set; }
        public string Title { get; set; }
        public string SeoName { get; set; }
        public string Excerpt { get; set; }
        public string Content { get; set; }
        public string Author { get; set; }
        public DateTime CreatedDateUTC { get; set; }
    }
}

public class BlogContext : DbContext
{
    public DbSet<Post> Post { get; set; }
    public BlogContext()
    { }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        if (!optionsBuilder.IsConfigured)
        {
            optionsBuilder.UseSqlite("Data Source=blogging.db");
            //optionsBuilder.UseSqlServer("Server=(localdb)\\mssqllocaldb;Database=demo-heart.db;Trusted_Connection=True;MultipleActiveResultSets=true");

        }
    }
}

Using Heart

Create ViewModel Class

namespace SimpleBlog.ViewModels
{
    // Create ViewModel using Heart 
    public class PostViewModel: ViewModelBase<BlogContext, Post, PostViewModel>    
    {
        //Declare properties that this viewmodel need         
        public string Id { get; set; }
        [Required(ErrorMessage = "Title is required")]        
        public string Title { get; set; }        
        public DateTime CreatedDateUTC { get; set; }
        
        //Declare properties need for view or convert from model to view        
        public DateTime CreatedDateLocal { get { return CreatedDateUTC.ToLocalTime(); } }        
        
        public PostViewModel()
        {
        }

        public PostViewModel(Post model, BlogContext _context = null, IDbContextTransaction _transaction = null) : base(model, _context, _transaction)
        {
        }
    }

Using

Save

var saveResult = await post.SaveModelAsync();

Get Single

var getPosts = await PostViewModel.Repository.GetSingleModelAsync(p=>p.Id==1);
return View(getPosts.Data);

Get All

var getPosts = await PostViewModel.Repository.GetModelListAsync();
return View(getPosts.Data);

Get All with predicate

var getPosts = await PostViewModel.Repository.GetModelListByAsync(p=>p.Title.Contains("some text"));
return View(getPosts.Data);

Get Paging

var getPosts = await PostViewModel.Repository.GetModelListAsync("CreatedDate", OrderByDirection.Descending, pageSize, pageIndex);
return View(getPosts.Data);

Get Paging with predicate

var getPosts = await PostViewModel.Repository.GetModelListByAsync(p=>p.Title.Contains("some text"), "CreatedDate", OrderByDirection.Descending, pageSize, pageIndex);
return View(getPosts.Data);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Mix.Heart:

Repository Stars
mixcore/mix.core
🚀 Mixcore CMS is an Future-Proof Enterprise Web CMS that supports both headless and decoupled to easily build any kinds of app/web app/all in all/customizable APIs built on top of ASP.NET Core / Dotnet Core. It is a completely open-source ASP.NET Core (Dotnet Core) CMS solution. https://mixcore.org
Version Downloads Last updated
1.1.0 28,549 11/10/2021
1.0.4.1 5,462 8/9/2021
1.0.4 487 8/6/2021
1.0.3.9 750 7/19/2021
1.0.3.8 287 7/17/2021
1.0.3.7 759 6/19/2021
1.0.3.6 214 6/11/2021
1.0.3.5 391 5/23/2021
1.0.3.4 169 5/21/2021
1.0.3.3 164 5/20/2021
1.0.3.2 464 5/18/2021
1.0.3.1 430 5/12/2021
1.0.3 462 5/10/2021
1.0.2 1,357 2/21/2021
1.0.1 426 2/21/2021
1.0.0 858 2/13/2021
0.0.8.7 421 2/13/2021
0.0.8.6 529 2/6/2021
0.0.8.5 532 1/29/2021
0.0.8.4 550 1/24/2021
0.0.8.3 761 1/16/2021
0.0.8.1 625 1/3/2021
0.0.8 426 12/27/2020
0.0.7.1 883 11/25/2020
0.0.7 412 11/24/2020
0.0.6.9 2,924 10/12/2020
0.0.6.8 774 9/22/2020
0.0.6.7 668 9/8/2020
0.0.6.6 609 8/31/2020
0.0.6.5 4,723 5/17/2020
0.0.6.4 2,190 4/4/2020
0.0.6.3 595 4/1/2020
0.0.6.2 5,486 3/13/2020
0.0.6.1 772 3/4/2020
0.0.6 797 2/26/2020
0.0.5.9 908 2/4/2020
0.0.5.8 1,387 12/21/2019
0.0.5.7 626 12/15/2019
0.0.5.6 769 12/1/2019
0.0.5.5 722 11/24/2019
0.0.5.4 627 11/17/2019
0.0.5.3 637 11/13/2019
0.0.5.2 650 11/3/2019
0.0.5.1 652 11/2/2019
0.0.5 687 10/20/2019
0.0.4.9 746 10/14/2019
0.0.4.8 640 10/11/2019
0.0.4.7 639 10/6/2019
0.0.4.6 1,191 9/20/2019
0.0.4.5 1,707 8/3/2019
0.0.4.4 658 8/1/2019
0.0.4.3 817 5/28/2019
0.0.4.2 914 5/11/2019
0.0.4.1 1,131 4/11/2019
0.0.4 1,156 4/4/2019
0.0.3 943 3/20/2019
0.0.2 1,108 2/7/2019
0.0.1 835 9/9/2018