Adds new database table + migration + unit test + fixes up unit tests to ensure PluginManager.Current = null; is done on teardown.
Created new ServerRegistrationRepository + unit tests + models
This commit is contained in:
32
src/Umbraco.Core/Models/Rdbms/ServerRegistrationDto.cs
Normal file
32
src/Umbraco.Core/Models/Rdbms/ServerRegistrationDto.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
|
||||
namespace Umbraco.Core.Models.Rdbms
|
||||
{
|
||||
[TableName("umbracoServer")]
|
||||
[PrimaryKey("id")]
|
||||
[ExplicitColumns]
|
||||
internal class ServerRegistrationDto
|
||||
{
|
||||
[Column("id")]
|
||||
[PrimaryKeyColumn(AutoIncrement = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column("address")]
|
||||
[Length(100)]
|
||||
public string Address { get; set; }
|
||||
|
||||
[Column("registeredDate")]
|
||||
[Constraint(Default = "getdate()")]
|
||||
public DateTime DateRegistered { get; set; }
|
||||
|
||||
[Column("lastNotifiedDate")]
|
||||
[Constraint(Default = "getdate()")]
|
||||
public DateTime LastNotified { get; set; }
|
||||
|
||||
[Column("isActive")]
|
||||
[Index(IndexTypes.NonClustered)]
|
||||
public bool IsActive { get; set; }
|
||||
}
|
||||
}
|
||||
46
src/Umbraco.Core/Models/ServerRegistration.cs
Normal file
46
src/Umbraco.Core/Models/ServerRegistration.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using Umbraco.Core.Models.EntityBase;
|
||||
using Umbraco.Core.Sync;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
internal class ServerRegistration : Entity, IServerAddress, IAggregateRoot
|
||||
{
|
||||
public ServerRegistration()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an item with pre-filled properties
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="serverAddress"></param>
|
||||
/// <param name="createDate"></param>
|
||||
/// <param name="updateDate"></param>
|
||||
public ServerRegistration(int id, string serverAddress, DateTime createDate, DateTime updateDate)
|
||||
{
|
||||
UpdateDate = updateDate;
|
||||
CreateDate = createDate;
|
||||
Key = Id.ToString().EncodeAsGuid();
|
||||
Id = id;
|
||||
ServerAddress = serverAddress;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance for persisting a new item
|
||||
/// </summary>
|
||||
/// <param name="serverAddress"></param>
|
||||
/// <param name="createDate"></param>
|
||||
public ServerRegistration(string serverAddress, DateTime createDate)
|
||||
{
|
||||
CreateDate = createDate;
|
||||
UpdateDate = createDate;
|
||||
Key = 0.ToString().EncodeAsGuid();
|
||||
ServerAddress = serverAddress;
|
||||
}
|
||||
|
||||
public string ServerAddress { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user