feat: 初始化NewLife Studio项目,完成基础框架与数据管理模块
何炳宏 authored at 2026-05-26 12:09:09
1.07 KiB
NewLife.Studio
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
        };
    }
}