Search found 17 matches

by ole.tetzschner
Fri 29 Apr 2022 15:54
Forum: Entity Developer
Topic: Visual Studio 2022
Replies: 29
Views: 1088575

Re: Visual Studio 2022

Hope you all are ok. Thanks for the update.

Slava Ukraini, heroyam slava!
by ole.tetzschner
Tue 08 Feb 2022 11:16
Forum: Entity Framework support
Topic: Spartial mapping exception
Replies: 3
Views: 23518

Re: Spartial mapping exception

Can see somebody just copied my question from 2020. But this is still a problem. I'm now on .NET 4.8 and 7.24.2066, when using database-first approach.

Code: Select all

CREATE EXTENSION postgis;

CREATE TABLE public."TestTable" (
  "Id" BIGSERIAL,
  "Location" public.geography
) 
WITH (oids = false);
When adding a new record in C# the exception are thrown.


Kind regards, Ole
by ole.tetzschner
Fri 25 Sep 2020 16:03
Forum: Entity Framework support
Topic: Spartial mapping exception
Replies: 2
Views: 14144

Spartial mapping exception

Hi

Using latest ef core postgresql on .net 4.7.2, on database first, I get the following exception whenever using dbcontext. Any clue would be appreciated


System.TypeLoadException

HResult=0x80131522

Message=Typen 'Devart.Data.PostgreSql.Entity.PgSqlTypeMapping' kunne ikke indlæses fra assemblyen 'Devart.Data.PostgreSql.Entity.EFCore, Version=7.18.1730.0, Culture=neutral, PublicKeyToken=09af7300eec23701'.

Source=Devart.Data.PostgreSql.Entity.EFCore.NetTopologySuite

StackTrace:

at Devart.Data.PostgreSql.Entity.c.a(RelationalTypeMappingInfo& A_0)

at Microsoft.EntityFrameworkCore.Storage.RelationalTypeMappingSource.FindMapping(RelationalTypeMappingInfo& mappingInfo)

at Devart.Common.Entity.c5.a(RelationalTypeMappingInfo& A_0)

at Microsoft.EntityFrameworkCore.Storage.RelationalTypeMappingSource.<FindMappingWithConversion>b__7_0(ValueTuple`3 k)

at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)

at Microsoft.EntityFrameworkCore.Storage.RelationalTypeMappingSource.FindMappingWithConversion(RelationalTypeMappingInfo& mappingInfo, IReadOnlyList`1 principals)

at Microsoft.EntityFrameworkCore.Storage.RelationalTypeMappingSource.FindMapping(MemberInfo member)

at Microsoft.EntityFrameworkCore.Metadata.Conventions.PropertyDiscoveryConvention.IsCandidatePrimitiveProperty(PropertyInfo propertyInfo)

at Microsoft.EntityFrameworkCore.Metadata.Conventions.PropertyDiscoveryConvention.Process(IConventionEntityTypeBuilder entityTypeBuilder)

at Microsoft.EntityFrameworkCore.Metadata.Conventions.PropertyDiscoveryConvention.ProcessEntityTypeAdded(IConventionEntityTypeBuilder entityTypeBuilder, IConventionContext`1 context)

at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ImmediateConventionScope.OnEntityTypeAdded(IConventionEntityTypeBuilder entityTypeBuilder)

at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.RunVisitor.VisitOnEntityTypeAdded(OnEntityTypeAddedNode node)

at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAddedNode.Accept(ConventionVisitor visitor)

at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionVisitor.Visit(ConventionNode node)

at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionVisitor.VisitConventionScope(ConventionScope node)

at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionBatch.Run()

at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionBatch.Dispose()

at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ImmediateConventionScope.OnModelInitialized(IConventionModelBuilder modelBuilder)

at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.OnModelInitialized(IConventionModelBuilder modelBuilder)

at Microsoft.EntityFrameworkCore.Metadata.Internal.Model..ctor(ConventionSet conventions)

at Microsoft.EntityFrameworkCore.ModelBuilder..ctor(ConventionSet conventions)

at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder)

at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.GetModel(DbContext context, IConventionSetBuilder conventionSetBuilder)

at Devart.Common.Entity.c2.GetModel(DbContext context, IConventionSetBuilder conventionSetBuilder)

at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel()

at Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model()

at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.<>c.<TryAddCoreServices>b__7_3(IServiceProvider p)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)

at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)

at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)

at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()

at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()

at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()

at Microsoft.EntityFrameworkCore.DbContext.SetEntityStates(IEnumerable`1 entities, EntityState entityState)

at Microsoft.EntityFrameworkCore.DbContext.AddRange(IEnumerable`1 entities)

at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.AddRange(IEnumerable`1 entities)

at ImportPOIs.Program.Main(String[] args) in C:\WORK\toolApps\ImportPOIs\ImportPOIs\Program.cs:line 102
by ole.tetzschner
Tue 15 Oct 2019 13:21
Forum: dotConnect for PostgreSQL
Topic: Bug in 7.14.1470 ?
Replies: 5
Views: 10520

Re: Bug in 7.14.1470 ?

Devart has reproduced this error. We are now waiting for a fix / update.
by ole.tetzschner
Tue 01 Oct 2019 11:24
Forum: dotConnect for PostgreSQL
Topic: Bug in 7.14.1470 ?
Replies: 5
Views: 10520

Bug in 7.14.1470 ?

Hi

After upgrading from 7.13.1437 to 7.14.1470, I can no longer update table-rows. I'm constantly getting the following Exception:

Code: Select all

invalid byte sequence for encoding "UTF8": 0x00
I've check with dbMonitor and both SQL-syntax and parameters looks fine.

My connectionString:

Code: Select all

connectionString="User Id=...;Password=...;Host=...;Database=...;Unicode=True;Persist Security Info=True;Schema=public"
I can read the rows without problem, but when I update, the above exception is thrown. I've always upgraded to the latest version, but never seen this before. Any clues would be appreciated.

With kind regards, Ole
by ole.tetzschner
Wed 16 Jan 2019 10:27
Forum: dotConnect for PostgreSQL
Topic: BUG in 7.11.1278 !!!
Replies: 7
Views: 7996

Re: BUG in 7.11.1278 !!!

After upgrading to 7.12.1307 the problem seems solved.
by ole.tetzschner
Mon 07 Jan 2019 10:17
Forum: dotConnect for PostgreSQL
Topic: BUG in 7.11.1278 !!!
Replies: 7
Views: 7996

Re: BUG in 7.11.1278 !!!

Additional information sent :)
by ole.tetzschner
Mon 31 Dec 2018 10:03
Forum: dotConnect for PostgreSQL
Topic: BUG in 7.11.1278 !!!
Replies: 7
Views: 7996

Re: BUG in 7.11.1278 !!!

Hi Shalex

A small test-project is sent. Hope to hear from you soon.

Kind regards and a happy new year, Ole
by ole.tetzschner
Fri 21 Dec 2018 13:49
Forum: dotConnect for PostgreSQL
Topic: BUG in 7.11.1278 !!!
Replies: 7
Views: 7996

BUG in 7.11.1278 !!!

Hi

After upgrading from 7.11.1253 (professional-edition) we are now constantly receiving ErrorCode "42601" with the text "{"syntax error at or near \")\""}".

My C# code:

Code: Select all

var myRow = myContext.MyTableBs
                        .Include("MyTableA")
                        .Include("MyTableC")
                        .Include("MyTableD")
                        .Where(t => t.Id == myId)
                        .FirstOrDefault();
SQL-code generated by Devart-lib:

Code: Select all

SELECT "t.MyTableC"."Id", "t.MyTableC"."MyColA"
FROM my_schema."MyTableC" "t.MyTableC"
INNER JOIN (
    SELECT DISTINCT t1.*
    FROM ((
        SELECT t0."Id"
        FROM my_schema."MyTableB" t0
        INNER JOIN my_schema."MyTableA" "t.MyTableA0" ON t0."MyTableAId" = "t.MyTableA0"."Id"
        WHERE t0."Id" = $1
        ORDER BY t0."Id"
        LIMIT 1
    ) AS t1)
) AS t2 ON "t.MyTableC"."MyTableBId" = t2."Id"
ORDER BY t2."Id"
Replacing $1 with a value and running the query in a database-manager, I can see the error is the ) just after AS t1


Any ETA on a error-fix?

Kind regards and merry Christmas from Ole
by ole.tetzschner
Thu 22 Nov 2018 08:03
Forum: dotConnect for PostgreSQL
Topic: Batch / bulk insert problem (EF Core)
Replies: 6
Views: 11397

Re: Batch / bulk insert problem (EF Core)

Thanks, but that's a no-go. If your program are incrementing the Id, it will lead to concurrency-issues (when two different connections are inserting huge data-sets).

But goofing around, I think I've got a solution. I'll remove all child-inserts from the first INSERT. Then, in-the-same-transaction, let PgSqlLoader (reuse the connection, and transaction) take care of the huge insert (now COPY). In my test-project it seems fast.

Kind regards, Ole
by ole.tetzschner
Sat 17 Nov 2018 09:19
Forum: dotConnect for PostgreSQL
Topic: Batch / bulk insert problem (EF Core)
Replies: 6
Views: 11397

Re: Batch / bulk insert problem (EF Core)

That does not work (I've already tried that).

1. Removing value-generated on Created (the timestamp with default now()), will result in table-dates 0001-01-01.
2. Removing value-generated on Id (bigserial auto incremented on postgresql-server), will result in the exception below:

Code: Select all

another instance with the key value '{Id: 0}' is already being tracked


How do you tell EF Core not to insert the columns Id and Created?
by ole.tetzschner
Mon 12 Nov 2018 11:34
Forum: dotConnect for PostgreSQL
Topic: Batch / bulk insert problem (EF Core)
Replies: 6
Views: 11397

Re: Batch / bulk insert problem (EF Core)

Shalex wrote: Fri 09 Nov 2018 10:19
ole.tetzschner wrote: Tue 06 Nov 2018 10:27lots of INSERT's (with RETURNING id and timestamp) instead of COPY. Why????
When you create an instance of the context for inserting a lot of records, turn off autogeneration for TIMESTAMPs and IDs in the mapping to avoid creating the RETURNING clause.
Thanks Shalex, but how do you accomplish this in EF Core (database-first)?

Snippet from DataModel1.efml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<efcore namespace="ConsoleApp1" p1:Guid="..." xmlns:p1="http://devart.com/schemas/EntityDeveloper/1.0">
  <class name="table2" entity-set="table2s" table="`table2`" schema="my_shema" p1:Guid="...">
    <id name="Id" type="Int64" value-generated="OnAdd" p1:ValidateRequired="true" p1:Guid="...">
      <column name="`Id`" not-null="True" sql-type="bigserial" p1:unicode="False" />
    </id>
    <property name="Created" type="DateTime" value-generated="OnAdd" p1:ValidateRequired="true" p1:Guid="...">
      <column name="`Created`" default="now()" not-null="True" sql-type="timestamptz" p1:unicode="False" />
    </property>
    <property name="myCol3" type="String" p1:ValidateRequired="true" p1:Guid="...">
      <column name="`myCol3`" not-null="True" sql-type="text" p1:unicode="True" />
    </property>
	...
by ole.tetzschner
Tue 06 Nov 2018 10:27
Forum: dotConnect for PostgreSQL
Topic: Batch / bulk insert problem (EF Core)
Replies: 6
Views: 11397

Batch / bulk insert problem (EF Core)

Hi

Can't get batch-insert working on EF Core (transaction). The child-tables are inserted one-by-one with a RETURNING (according to dbMonitor).

In my inherit class:

Code: Select all

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UsePostgreSql( connectionString);

            PgSqlEntityProviderConfig config = PgSqlEntityProviderConfig.Instance;
            config.DmlOptions.BatchUpdates.Enabled = true;
            config.DmlOptions.BatchUpdates.BatchSize = 100;
        }
It must be in a transaction (according to the first DELETE).

Code: Select all

	var pgMon = new PgSqlMonitor();
	pgMon.IsActive = true;

	using (var myContext = new MyDataModel("User Id=...;Password=...;Host=...;Database=...;Unicode=True;Persist Security Info=True;Initial Schema=..."))
	{
		myContext.Database.BeginTransaction();

		// DELETE
		myContext.myTable1.RemoveRange(myContext.myTable1
									.Where(s => s.t1Id == "00001"));
		myContext.SaveChanges();

		// INSERT (bulk/batch)
		// ...
		// myData is one record of table1 and multiple one-to-many relation to table2 (and table3). All tables has autogenerated ID's and TIMESTAMPs (when inserted).
		// 

		myContext.myTable1.Add(myData);
		int c1 = myContext.SaveChanges();

		myContext.Database.CommitTransaction();

		pgMon.IsActive = false;
		pgMon.Dispose();
	}
BUT dbMonitor shows lots of INSERT's (with RETURNING id and timestamp) instead of COPY. Why????
by ole.tetzschner
Thu 01 Nov 2018 20:56
Forum: LinqConnect (LINQ to SQL support)
Topic: BUG or problem in earger loading grandchildren
Replies: 7
Views: 10307

Re: BUG or problem in earger loading grandchildren

Hi shalex

But the doc says that this is not supported on EF Core. Is the doc outdated or what are the ETA for this feature?

https://www.devart.com/dotconnect/postg ... tions.html
by ole.tetzschner
Sun 22 Jul 2018 09:46
Forum: LinqConnect (LINQ to SQL support)
Topic: BUG or problem in earger loading grandchildren
Replies: 7
Views: 10307

Re: BUG or problem in earger loading grandchildren

Thanks shalex. The world might be spinning around mysql, but my world are spinning around postgresql 😉
EF Core rocks and solved the problem with two Include-statenents. The performance incresed 18x 👍👍👍
That said, the EF Core don't seem fit for bulk/batch INSERT's (in transaction) for the same table-structure. Any wise thoughts on this topic? All tables has auto-generated Id and Timestamp, which result in a RETURNING.

Kind regards, Ole