SankhyaAPI.Client 4.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package SankhyaAPI.Client --version 4.3.0
                    
NuGet\Install-Package SankhyaAPI.Client -Version 4.3.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SankhyaAPI.Client" Version="4.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SankhyaAPI.Client" Version="4.3.0" />
                    
Directory.Packages.props
<PackageReference Include="SankhyaAPI.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SankhyaAPI.Client --version 4.3.0
                    
#r "nuget: SankhyaAPI.Client, 4.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=SankhyaAPI.Client&version=4.3.0
                    
Install SankhyaAPI.Client as a Cake Addin
#tool nuget:?package=SankhyaAPI.Client&version=4.3.0
                    
Install SankhyaAPI.Client as a Cake Tool

👜 SankhyaAPI.Client

GitHub issues GitHub forks GitHub stars GitHub license GitHub Languages Nuget

Projeto de integração com ERP Sankhya para operação de CRUD!

📑 Índice

🚀 Sobre

Este projeto tem como objetivo disponibilizar, de maneira mais sucinta, métodos mais utilizados para manipulações e retornos de dados. Utilizando a própria API do Sankhya disponível aqui, o projeto abstrai os métodos para o usuário.

📦 Instalação

  1. Na raiz do seu projeto, use o seguinte comando:
    dotnet add package SankhyaAPI.Client --version x.y.z
    

⚙ Configuração

Este pacote foi pensado para uso com injeção de dependência.

  1. Configure o SankhyaClientSettings:

    SankhyaClientSettings sankhyaSettings = new SankhyaClientSettings();
    sankhyaSettings.BaseUrl = "https://seusistema.sankhya.com";
    sankhyaSettings.Usuario = "usuario";
    sankhyaSettings.Senha = "senha";
    builder.Services.Configure<SankhyaClientSettings>(sankhyaSettings);
    
  2. Injete o serviço:

    builder.Services.AddSankhyaClient();
    

🧠 Validação de modelos

Todos os modelos devem herdar de SankhyaModelBase. Todas as propriedades devem ser NullableState<T>. As chaves primárias (com atributo [Key]) devem estar com:

  • AutoEnumerable == true: obrigatoriamente UnSet
  • AutoEnumerable == false: obrigatoriamente Set
  • Nunca podem estar com Clear

⚙️ Funcionalidades

  1. Exemplo de entidade:

    public class ProdutoEntity : SankhyaModelBase
    {
        [Key("CODPROD", true)] public NullableState<long> CodProd { get; set; }
        [XmlElement("CODVOL")] public NullableState<string> CodVol { get; set; }
        [XmlElement("DESCRPROD")] public NullableState<string> DescrProd { get; set; }
        [XmlElement("REFFORN")] public NullableState<string> RefForn { get; set; }
    }
    
  2. Serviço da entidade usando nome da entidade como string:

    public class ProdutoClientService : BaseService<ProdutoEntity>
    {
        public ProdutoClientService(IOptions<SankhyaClientSettings> sankhyaApiConfig)
            : base(sankhyaApiConfig, "Produto") { }
    }
    

🧪 Uso

Inserir

var produtos = new List<ProdutoEntity>
{
    new() { CodProd = 1, CodVol = "UN", DescrProd = "Produto A", RefForn = "F123" },
    new() { CodProd = 2, CodVol = "UN", DescrProd = "Produto B", RefForn = "F456" }
};
var response = await produtoClientService.CreateManyAsync(produtos);

Atualizar

produtos[0].DescrProd = "Produto A Atualizado";
var response = await produtoClientService.UpdateManyAsync(produtos);

Buscar registros com FindAsync

string query = "this.CODPROD = 1 AND this.AD_ATIVO = 'S'";
var produtos = await produtoClientService.FindAsync(query);

Query tipada com QueryRawAsync

string script = "SELECT CODPROD, DESCRPROD FROM TGFPRO WHERE ATIVO = 'S'";
List<ProdutoEntity> resultado = await produtoClientService.QueryRawAsync<ProdutoEntity>(script);

Query como dicionário com QueryAsDictionaryAsync

string script = "SELECT CODPROD, DESCRPROD FROM TGFPRO WHERE ATIVO = 'S'";
List<Dictionary<string, object?>> resultadoDict = await produtoClientService.QueryAsDictionaryAsync(script);

📄 Licença

Este projeto está sob a licença MIT. Veja o arquivo LICENSE para mais detalhes.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.1.0 0 4/15/2025
5.0.0 90 4/11/2025
4.3.0 115 4/10/2025
4.2.0 153 4/10/2025
4.1.0 200 4/10/2025 4.1.0 is deprecated because it has critical bugs.
4.0.1 201 4/10/2025 4.0.1 is deprecated because it has critical bugs.
4.0.0 203 4/4/2025 4.0.0 is deprecated because it has critical bugs.
3.2.0 246 4/3/2025 3.2.0 is deprecated because it has critical bugs.
3.1.0 235 4/2/2025 3.1.0 is deprecated because it has critical bugs.
3.0.1 233 4/1/2025 3.0.1 is deprecated because it has critical bugs.
3.0.0 228 4/1/2025 3.0.0 is deprecated because it has critical bugs.
2.1.0 239 3/31/2025 2.1.0 is deprecated because it has critical bugs.
2.0.0 222 11/11/2024
1.1.0 226 11/2/2024 1.1.0 is deprecated because it has critical bugs.
1.0.1 212 11/1/2024 1.0.1 is deprecated because it has critical bugs.
1.0.0 209 11/1/2024 1.0.0 is deprecated because it has critical bugs.
0.5.2.11 220 10/29/2024 0.5.2.11 is deprecated because it has critical bugs.
0.5.2.10 211 10/29/2024 0.5.2.10 is deprecated because it has critical bugs.
0.5.2.9 198 10/29/2024 0.5.2.9 is deprecated because it has critical bugs.
0.5.2.8 205 10/29/2024 0.5.2.8 is deprecated because it has critical bugs.
0.5.2.7 201 10/29/2024 0.5.2.7 is deprecated because it has critical bugs.
0.5.2.6 197 10/29/2024 0.5.2.6 is deprecated because it has critical bugs.
0.5.2.5 214 10/29/2024 0.5.2.5 is deprecated because it has critical bugs.
0.5.2.4 218 10/29/2024 0.5.2.4 is deprecated because it has critical bugs.
0.5.2.3 203 10/25/2024 0.5.2.3 is deprecated because it has critical bugs.
0.5.2.2 194 10/25/2024 0.5.2.2 is deprecated because it has critical bugs.
0.5.2.1 199 10/25/2024 0.5.2.1 is deprecated because it has critical bugs.
0.5.2 199 10/24/2024 0.5.2 is deprecated because it has critical bugs.
0.5.1 201 10/24/2024 0.5.1 is deprecated because it has critical bugs.
0.5.0 200 10/23/2024 0.5.0 is deprecated because it has critical bugs.
0.4.2 203 10/15/2024 0.4.2 is deprecated because it has critical bugs.
0.4.1 201 10/15/2024 0.4.1 is deprecated because it has critical bugs.
0.4.0 211 10/15/2024 0.4.0 is deprecated because it has critical bugs.
0.3.3 209 10/14/2024 0.3.3 is deprecated because it has critical bugs.
0.3.2 207 10/14/2024 0.3.2 is deprecated because it has critical bugs.
0.3.1 209 10/14/2024 0.3.1 is deprecated because it has critical bugs.
0.3.0 204 10/14/2024 0.3.0 is deprecated because it has critical bugs.
0.2.0 208 10/12/2024 0.2.0 is deprecated because it has critical bugs.
0.1.2 211 10/11/2024 0.1.2 is deprecated because it has critical bugs.
0.1.1 251 10/11/2024 0.1.1 is deprecated because it has critical bugs.
0.1.0 204 10/11/2024 0.1.0 is deprecated because it has critical bugs.