DocSpace-client/common/ASC.Core.Common/EF/Model/Tenant/DbQuotaRow.cs

36 lines
922 B
C#
Raw Normal View History

2019-12-02 09:12:16 +00:00
using System;
using System.ComponentModel.DataAnnotations.Schema;
2019-12-17 13:01:59 +00:00
using Microsoft.EntityFrameworkCore;
2019-12-02 09:12:16 +00:00
namespace ASC.Core.Common.EF
{
[Table("tenants_quotarow")]
2019-12-17 13:01:59 +00:00
public class DbQuotaRow : BaseEntity
2019-12-02 09:12:16 +00:00
{
public int Tenant { get; set; }
public string Path { get; set; }
public long Counter { get; set; }
public string Tag { get; set; }
[Column("last_modified")]
public DateTime LastModified { 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[] { Tenant, Path };
}
}
public static class DbQuotaRowExtension
{
public static ModelBuilder AddDbQuotaRow(this ModelBuilder modelBuilder)
{
2020-09-30 11:50:39 +00:00
_ = modelBuilder.Entity<DbQuotaRow>()
2019-12-17 13:01:59 +00:00
.HasKey(c => new { c.Tenant, c.Path });
return modelBuilder;
}
2019-12-02 09:12:16 +00:00
}
}