crate / crate-npgsql

A plugin that provides extensions to Npgsql which enable usage of Npgsql as a .NET data provider for CrateDB.
Apache License 2.0
11 stars 5 forks source link

Version specifications missing #42

Closed PhilippJust closed 3 years ago

PhilippJust commented 4 years ago

Documentation feedback


I tried to use the Npsql client for cratedb as described in the docs with a minimum example. I have a three-node-cluster running with a docker image on localhost.

Here is the very simple console app

.csproj file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Npgsql" Version="4.1.3.1" />
    <PackageReference Include="Npgsql.CrateDb" Version="1.2.3" />
  </ItemGroup>
</Project>

Executed file with the code copy-pasted from the docs

using Npgsql;
using Npgsql.CrateDb;

namespace CrateHelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            NpgsqlDatabaseInfo.RegisterFactory(new CrateDbDatabaseInfoFactory());
            var connString = "Host=127.0.0.1;Username=crate;SSL Mode=Prefer";

            using (var conn = new NpgsqlConnection(connString))
            {
                conn.Open();
            }
        }
    }
}

However conn.Open() always throws an exception An unhandled exception of type 'System.MissingMethodException' occurred in System.Private.CoreLib.dll: 'Method not found: 'Void Npgsql.NpgsqlDatabaseInfo..ctor()'.'

I only got it running when downgrading Npgsql to version 4.0.10. This should be written somewhere as it is really frustrating to not get a hello world running :)

infoverload commented 4 years ago

@PhilippJust Thanks for your valuable feedback! We definitely want our tutorials to be a smooth process and will file an issue and update the docs soon.

nomicode commented 3 years ago

this was fixed a while ago