DocSpace-client/common/ASC.Core.Common/EF/Model/Notify/NotifyInfo.cs

83 lines
2.7 KiB
C#
Raw Normal View History

2020-08-21 02:34:37 +00:00
using Microsoft.EntityFrameworkCore;
2020-10-12 16:23:15 +00:00
2020-08-21 02:34:37 +00:00
using System;
2019-12-10 13:42:29 +00:00
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace ASC.Core.Common.EF.Model
{
[Table("notify_info")]
public class NotifyInfo
{
[Key]
[Column("notify_id")]
public int NotifyId { get; set; }
public int State { get; set; }
public int Attempts { get; set; }
[Column("modify_date")]
public DateTime ModifyDate { get; set; }
public int Priority { get; set; }
}
2020-08-21 02:34:37 +00:00
public static class NotifyInfoExtension
{
2020-09-06 22:49:03 +00:00
public static ModelBuilderWrapper AddNotifyInfo(this ModelBuilderWrapper modelBuilder)
{
2020-10-10 11:35:05 +00:00
_ = modelBuilder
2020-09-06 22:49:03 +00:00
.Add(MySqlAddNotifyInfo, Provider.MySql)
2020-10-08 09:07:05 +00:00
.Add(PgSqlAddNotifyInfo, Provider.Postgre);
2020-09-06 22:49:03 +00:00
return modelBuilder;
}
public static void MySqlAddNotifyInfo(this ModelBuilder modelBuilder)
2020-08-21 02:34:37 +00:00
{
2020-10-10 11:35:05 +00:00
_ = modelBuilder.Entity<NotifyInfo>(entity =>
2020-08-21 02:34:37 +00:00
{
2020-10-10 11:35:05 +00:00
_ = entity.HasKey(e => e.NotifyId)
2020-08-21 02:34:37 +00:00
.HasName("PRIMARY");
2020-10-10 11:35:05 +00:00
_ = entity.ToTable("notify_info");
2020-08-21 02:34:37 +00:00
2020-10-10 11:35:05 +00:00
_ = entity.HasIndex(e => e.State)
2020-08-21 02:34:37 +00:00
.HasName("state");
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.NotifyId).HasColumnName("notify_id");
2020-08-21 02:34:37 +00:00
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.Attempts).HasColumnName("attempts");
2020-08-21 02:34:37 +00:00
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.ModifyDate)
2020-08-21 02:34:37 +00:00
.HasColumnName("modify_date")
.HasColumnType("datetime");
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.Priority).HasColumnName("priority");
2020-08-21 02:34:37 +00:00
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.State).HasColumnName("state");
2020-08-21 02:34:37 +00:00
});
}
2020-09-06 22:49:03 +00:00
public static void PgSqlAddNotifyInfo(this ModelBuilder modelBuilder)
2020-08-21 02:34:37 +00:00
{
2020-10-10 11:35:05 +00:00
_ = modelBuilder.Entity<NotifyInfo>(entity =>
2020-08-21 02:34:37 +00:00
{
2020-10-10 11:35:05 +00:00
_ = entity.HasKey(e => e.NotifyId)
2020-08-21 02:34:37 +00:00
.HasName("notify_info_pkey");
2020-10-10 11:35:05 +00:00
_ = entity.ToTable("notify_info", "onlyoffice");
2020-08-21 02:34:37 +00:00
2020-10-10 11:35:05 +00:00
_ = entity.HasIndex(e => e.State)
2020-08-21 02:34:37 +00:00
.HasName("state");
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.NotifyId)
2020-08-21 02:34:37 +00:00
.HasColumnName("notify_id")
.ValueGeneratedNever();
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.Attempts).HasColumnName("attempts");
2020-08-21 02:34:37 +00:00
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.ModifyDate).HasColumnName("modify_date");
2020-08-21 02:34:37 +00:00
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.Priority).HasColumnName("priority");
2020-08-21 02:34:37 +00:00
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.State).HasColumnName("state");
2020-08-21 02:34:37 +00:00
});
}
}
2019-12-10 13:42:29 +00:00
}