SankhyaAPI.Client 4.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package SankhyaAPI.Client --version 4.2.0
                    
NuGet\Install-Package SankhyaAPI.Client -Version 4.2.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.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SankhyaAPI.Client" Version="4.2.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.2.0
                    
#r "nuget: SankhyaAPI.Client, 4.2.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.2.0
                    
Install SankhyaAPI.Client as a Cake Addin
#tool nuget:?package=SankhyaAPI.Client&version=4.2.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 169 8 days ago
5.0.0 121 13 days ago
4.3.0 141 13 days ago
4.2.0 179 13 days ago
4.1.0 230 13 days ago 4.1.0 is deprecated because it has critical bugs.
4.0.1 234 14 days ago 4.0.1 is deprecated because it has critical bugs.
4.0.0 206 19 days ago 4.0.0 is deprecated because it has critical bugs.
3.2.0 251 20 days ago 3.2.0 is deprecated because it has critical bugs.
3.1.0 238 21 days ago 3.1.0 is deprecated because it has critical bugs.
3.0.1 234 23 days ago 3.0.1 is deprecated because it has critical bugs.
3.0.0 229 23 days ago 3.0.0 is deprecated because it has critical bugs.
2.1.0 239 23 days ago 2.1.0 is deprecated because it has critical bugs.
2.0.0 224 5 months ago
1.1.0 229 6 months ago 1.1.0 is deprecated because it has critical bugs.
1.0.1 215 6 months ago 1.0.1 is deprecated because it has critical bugs.
1.0.0 212 6 months ago 1.0.0 is deprecated because it has critical bugs.
0.5.2.11 224 6 months ago 0.5.2.11 is deprecated because it has critical bugs.
0.5.2.10 214 6 months ago 0.5.2.10 is deprecated because it has critical bugs.
0.5.2.9 203 6 months ago 0.5.2.9 is deprecated because it has critical bugs.
0.5.2.8 208 6 months ago 0.5.2.8 is deprecated because it has critical bugs.
0.5.2.7 204 6 months ago 0.5.2.7 is deprecated because it has critical bugs.
0.5.2.6 200 6 months ago 0.5.2.6 is deprecated because it has critical bugs.
0.5.2.5 219 6 months ago 0.5.2.5 is deprecated because it has critical bugs.
0.5.2.4 221 6 months ago 0.5.2.4 is deprecated because it has critical bugs.
0.5.2.3 206 6 months ago 0.5.2.3 is deprecated because it has critical bugs.
0.5.2.2 197 6 months ago 0.5.2.2 is deprecated because it has critical bugs.
0.5.2.1 202 6 months ago 0.5.2.1 is deprecated because it has critical bugs.
0.5.2 202 6 months ago 0.5.2 is deprecated because it has critical bugs.
0.5.1 205 6 months ago 0.5.1 is deprecated because it has critical bugs.
0.5.0 203 6 months ago 0.5.0 is deprecated because it has critical bugs.
0.4.2 207 6 months ago 0.4.2 is deprecated because it has critical bugs.
0.4.1 204 6 months ago 0.4.1 is deprecated because it has critical bugs.
0.4.0 214 6 months ago 0.4.0 is deprecated because it has critical bugs.
0.3.3 214 6 months ago 0.3.3 is deprecated because it has critical bugs.
0.3.2 210 6 months ago 0.3.2 is deprecated because it has critical bugs.
0.3.1 212 6 months ago 0.3.1 is deprecated because it has critical bugs.
0.3.0 209 6 months ago 0.3.0 is deprecated because it has critical bugs.
0.2.0 211 6 months ago 0.2.0 is deprecated because it has critical bugs.
0.1.2 214 6 months ago 0.1.2 is deprecated because it has critical bugs.
0.1.1 254 6 months ago 0.1.1 is deprecated because it has critical bugs.
0.1.0 208 6 months ago 0.1.0 is deprecated because it has critical bugs.