Ivy.Dbml.Parser 1.0.3

dotnet add package Ivy.Dbml.Parser --version 1.0.3
                    
NuGet\Install-Package Ivy.Dbml.Parser -Version 1.0.3
                    
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="Ivy.Dbml.Parser" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ivy.Dbml.Parser" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Ivy.Dbml.Parser" />
                    
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 Ivy.Dbml.Parser --version 1.0.3
                    
#r "nuget: Ivy.Dbml.Parser, 1.0.3"
                    
#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=Ivy.Dbml.Parser&version=1.0.3
                    
Install Ivy.Dbml.Parser as a Cake Addin
#tool nuget:?package=Ivy.Dbml.Parser&version=1.0.3
                    
Install Ivy.Dbml.Parser as a Cake Tool

DBML Parser for Dotnet

Database Markup Language (DBML), designed to define and document database structures. See the original repository.

This is initially a port of https://github.com/nilswende/dbml-java with loads some additions and refactorings.

Installation

You can install the package via NuGet Package Manager:

dotnet add package Ivy.Dbml.Parser

Or via the Package Manager Console:

Install-Package Ivy.Dbml.Parser

Usage

Here's a basic example of how to use the DBML Parser:

using Ivy.Dbml.Parser.Parser;
using Ivy.Dbml.Parser.Models;

// Create a new parser instance
var parser = new DbmlParser();

// Parse DBML content
string dbmlContent = @"
Project MyDatabase {
  Note: 'My project description'
}

Table users {
  id integer [pk]
  name varchar [not null]
  email varchar [unique]
}

Table posts {
  id integer [pk]
  user_id integer
  title varchar
  body text [note: 'Post content']
}

Ref: posts.user_id > users.id
";

// Get the parsed model
DbmlModel model = parser.Parse(dbmlContent);

// Access the parsed data
var projectName = model.ProjectName;
var tables = model.Tables;
var references = model.References;

// Example: Print table names
foreach (var table in tables)
{
    Console.WriteLine($"Table: {table.Name}");
    foreach (var column in table.Columns)
    {
        Console.WriteLine($"  Column: {column.Name} ({column.Type})");
    }
}

Features

  • Parse DBML project definitions
  • Parse table definitions with columns and their properties
  • Support for table aliases and notes
  • Parse indexes (single-column and multi-column)
  • Parse references between tables
  • Support for quoted identifiers
  • Support for default values and constraints

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Ivy.Dbml.Parser:

Package Downloads
Ivy.Dbml.Parser.Demo

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 150 4/6/2025
1.0.2 141 4/6/2025