I'm using PostgreSQL.Linq. If i'm using any entity that has foreign key and adding both to model then if I try to update any values in loaded entity - it will throw NullReferenceException in SendPropertyChanging method.
Example:
Code: Select all
CREATE TABLE public.test_link
(
id serial NOT NULL,
test_date timestamp with time zone NOT NULL,
test_val text COLLATE pg_catalog."default",
CONSTRAINT test_link_pkey PRIMARY KEY (id)
)
CREATE TABLE public.test
(
id serial NOT NULL,
my_date timestamp with time zone NOT NULL,
test text COLLATE pg_catalog."default" NOT NULL,
test_link integer,
CONSTRAINT test_pkey PRIMARY KEY (id),
CONSTRAINT test_fk FOREIGN KEY (test_link)
REFERENCES public.test_link (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
)
Code: Select all
using (postgresModel db = new postgresModel())
{
var log = db.Tests.FirstOrDefault();
log.MyDate = DateTime.Now;//exception is here. Updating of text column (or any other) throws exception too
db.SubmitChanges();
}
Devart.Data.PostgreSql.Linq v4.8.1566
NetCore 2.1.4
Code: Select all
- $exception {System.NullReferenceException: Object reference not set to an instance of an object.
at .(ILGenerator , MetaType )
at .(MetaType )
at Devart.Data.Linq.Mapping.MetaType.()
at Devart.Data.Linq.Mapping.MetaType.(Object )
at .3nxbbzw4xerph56q55jgvex7tkhjgxtn ()
at .(Object , PropertyChangingEventArgs )
at PostgreContext.Test.SendPropertyChanging(String propertyName) in C:\Users\LordXaosa\source\repos\PGTest\PGTest\DB.Designer.cs:line 479
at PostgreContext.Test.set_Test1(String value) in C:\Users\LordXaosa\source\repos\PGTest\PGTest\DB.Designer.cs:line 390
at PGTest.Program.Main(String[] args) in C:\Users\LordXaosa\source\repos\PGTest\PGTest\Program.cs:line 15} System.NullReferenceException