Cafe.Components.Mongo 1.3.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Cafe.Components.Mongo --version 1.3.0                
NuGet\Install-Package Cafe.Components.Mongo -Version 1.3.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="Cafe.Components.Mongo" Version="1.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Cafe.Components.Mongo --version 1.3.0                
#r "nuget: Cafe.Components.Mongo, 1.3.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 Cafe.Components.Mongo as a Cake Addin
#addin nuget:?package=Cafe.Components.Mongo&version=1.3.0

// Install Cafe.Components.Mongo as a Cake Tool
#tool nuget:?package=Cafe.Components.Mongo&version=1.3.0                

Cafe.Components.Mongo

简介

这是一个对MongoDB驱动进行一个简单封装的类,能够快速的帮助开发人员Code-Fisrt快速实现业务需求. 在下面我会给出响应的demo. 另外多说一句: 关于在什么情况下使用NoSql ,我觉得最适合的场景应该是在事件溯源架构场景下用作事件存储.

开始使用

DAL, Model 层引用该类库 Cafe.Components.Mongo

实体类Demo:

    /// <summary>
    /// 系统用户
    /// </summary>
    public class JustUser : MongoEntityBase
    {
        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 工号
        /// </summary>
        public string WorkId { get; set; }


        /// <summary>
        /// 用户角色
        /// </summary>
        public JustUserRole Role = JustUserRole.Users;

        /// <summary>
        /// 密码
        /// </summary>
        public string Password { get; set; } = string.Empty;
    }

数据访问层Demo:

  public class JustUserDal: MongoDalBase<JustUser>
  {
     
  }

分页查询Demo:

public List<JustUser> GetUsers(int pageIndex, int pageSize, out long count, string userName = null)
{
  count = 0;
  var dal = new JustUserDal();
  Expression<Func<JustUser, bool>> expression = null;
  if (userName.IsNotNullOrEmpty())
  {
    expression = p => p.UserName.Contains(userName);
  }
  var result = dal.AsQueryable().Page<JustUser>(pageIndex, pageSize, expression);
  if (result.IsNotNull() && result.Result.HasAny())
  {
    count = result.Count;
    result.Result.ForEach(p => p.Password = string.Empty);
    return result.Result;
  }
  else
  {
    return null;
  }
}
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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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

This package is not used by any popular GitHub repositories.

Version Downloads Last updated