DocSpace-buildtools/common/ASC.Core.Common/EF/Model/AccountLinks.cs

104 lines
3.4 KiB
C#
Raw Normal View History

2019-12-04 11:40:42 +00:00
using System;
using System.ComponentModel.DataAnnotations.Schema;
2019-12-17 13:01:59 +00:00
2019-12-04 11:40:42 +00:00
using Microsoft.EntityFrameworkCore;
namespace ASC.Core.Common.EF.Model
{
[Table("account_links")]
2019-12-17 13:01:59 +00:00
public class AccountLinks : BaseEntity
2019-12-04 11:40:42 +00:00
{
public string Id { get; set; }
public string UId { get; set; }
public string Provider { get; set; }
public string Profile { get; set; }
public DateTime Linked { get; set; }
2019-12-17 13:01:59 +00:00
2020-02-21 12:38:04 +00:00
public override object[] GetKeys()
2019-12-17 13:01:59 +00:00
{
return new object[] { Id, UId };
}
2019-12-04 11:40:42 +00:00
}
public static class AccountLinksExtension
{
2020-08-21 02:34:37 +00:00
public static ModelBuilder MySqlAddAccountLinks(this ModelBuilder modelBuilder)
2019-12-04 11:40:42 +00:00
{
2020-08-21 02:34:37 +00:00
modelBuilder.Entity<AccountLinks>(entity =>
{
entity.HasKey(e => new { e.Id, e.UId })
.HasName("PRIMARY");
entity.ToTable("account_links");
entity.HasIndex(e => e.UId)
.HasName("uid");
entity.Property(e => e.Id)
.HasColumnName("id")
.HasColumnType("varchar(200)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
entity.Property(e => e.UId)
.HasColumnName("uid")
.HasColumnType("varchar(200)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
entity.Property(e => e.Linked)
.HasColumnName("linked")
.HasColumnType("datetime");
entity.Property(e => e.Profile)
.IsRequired()
.HasColumnName("profile")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
entity.Property(e => e.Provider)
.HasColumnName("provider")
.HasColumnType("char(60)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
});
return modelBuilder;
}
public static ModelBuilder PgSqlAddAccountLinks(this ModelBuilder modelBuilder)
{
modelBuilder.Entity<AccountLinks>(entity =>
{
entity.HasKey(e => new { e.Id, e.UId })
.HasName("account_links_pkey");
entity.ToTable("account_links", "onlyoffice");
entity.HasIndex(e => e.UId)
.HasName("uid")
.HasOperators(new[] { "varchar_ops" });
entity.Property(e => e.Id)
.HasColumnName("id")
.HasMaxLength(200);
entity.Property(e => e.UId)
.HasColumnName("uid")
.HasMaxLength(200);
entity.Property(e => e.Linked).HasColumnName("linked");
entity.Property(e => e.Profile)
.IsRequired()
.HasColumnName("profile");
entity.Property(e => e.Provider)
.HasColumnName("provider")
.HasMaxLength(60)
.IsFixedLength();
});
return modelBuilder;
2019-12-04 11:40:42 +00:00
}
}
}