using NewLife.Studio.Core.DTOs;
namespace NewLife.Studio.Store.Models;
/// <summary>持久化连接格式</summary>
public class StoredConnection
{
public string Id { get; set; } = "";
public string Name { get; set; } = "";
public string ConnectionString { get; set; } = "";
public string ProviderType { get; set; } = "sqlite";
public DateTime LastUsedAt { get; set; }
public string Group { get; set; } = "";
public ConnectionInfo ToDto()
{
return new ConnectionInfo
{
Id = Id,
Name = Name,
ConnectionString = ConnectionString,
ProviderType = ProviderType,
LastUsedAt = LastUsedAt,
Group = Group
};
}
public static StoredConnection FromDto(ConnectionInfo dto)
{
return new StoredConnection
{
Id = dto.Id,
Name = dto.Name,
ConnectionString = dto.ConnectionString,
ProviderType = dto.ProviderType,
LastUsedAt = dto.LastUsedAt,
Group = dto.Group
};
}
}
|