PedroDB.Engine 1.0.0

dotnet add package PedroDB.Engine --version 1.0.0                
NuGet\Install-Package PedroDB.Engine -Version 1.0.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="PedroDB.Engine" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PedroDB.Engine --version 1.0.0                
#r "nuget: PedroDB.Engine, 1.0.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.
// Install PedroDB.Engine as a Cake Addin
#addin nuget:?package=PedroDB.Engine&version=1.0.0

// Install PedroDB.Engine as a Cake Tool
#tool nuget:?package=PedroDB.Engine&version=1.0.0                

PedroDB

C# Interface Example

Nota: Todas as classes estão no namespace PedroDB

Inicializações

Primeiramente, deve-se criar um objeto representando a engine PedroDB. Note que o DatabasePath é o caminho onde o sistema ficará armazenado. Exemplo:

EngineConfiguration config = new() {
  DatabasePath = Environment.CurrentDirectory + "/db"
};
PedroEngine engine = new(config);

Para manipular bancos de dados, podem ser usados os métodos:

  • void AddDatabase(string name)
  • void RemoveDatabase(string name)
  • Database GetDatabase(string name)

Segue um exemplo:

engine.AddDatabase("library");
Database db = engine.GetDatabase("library");

Similarmente, existem tais métodos para gerenciar coleções dentro de um banco de dados:

  • void AddCollection(string name)
  • void RemoveCollection(string name)
  • Collection<T> GetCollection<T>(string name)

Segue um exemplo de como criar e pegar uma coleção de pessoas:

db.AddCollection("users");
Collection<Person> people = db.GetCollection<Person>("users");

Usando na prática

Após criar e pegar uma coleção, pode-se adicionar itens à ela, exemplo:

// people é Collection<Person>
people.Add(new Person("Pedro", 18));
people.Add(new Person("John", 20));
people.Add(new Person("Jane", 21));

E quando necessário, pode ser usado um loop normal para procurar itens:

foreach(var p in people) {
  Console.WriteLine(p.Name);
  Console.WriteLine(p.Age);
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

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
1.0.0 159 5/15/2023