PostgreSQL - Does not contain a definition for

After an update and a infer Schema the project gives the following error:

radzen: Generating code ...
radzen: Code generation done in 197ms.
dotnet: Data\DtmsContext.cs(51,60): error CS1061: 'Contact' does not contain a definition for 'approval_entity_id' and no accessible extension method 'approval_entity_id' accepting a first argument of type 'Contact' could be found (are you missing a using directive or an assembly reference?) [C:\Users\xxx\Documents\RADZen\teste\server\project.csproj]

dotnet: Data\DtmsContext.cs(81,62): error CS1061: 'Event' does not contain a definition for 'boudary_id' and no accessible extension method 'boudary_id' accepting a first argument of type 'Event' could be found (are you missing a using directive or an assembly reference?) [C:\Users\xxx\Documents\RADZen\teste\server\project.csproj]

dotnet:

dotnet: The build failed. Please fix the build errors and run again.

PS; With an old version, this doesn't happen. (2.12.2)

Please send us your database schema.

I have already send a email to info@radzem.com with the script to generate schema.
Best regards

Hi,

You have foreign keys with misspelled or missing field names. I've sent you email with more info.

Ok, i think you have a bug in the database "Infer Schema", postgressql, mssql is fine. Regardless of whether the field name is misspelled or even spelled differently, you are forcing to be the "table name" _ "identity field" check the following example:

Postgres database script

--
-- PostgreSQL database dump

-- Dumped from database version 9.6.15
-- Dumped by pg_dump version 12.0

-- Started on 2019-11-13 11:41:18

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

SET default_tablespace = '';

--
-- TOC entry 186 (class 1259 OID 30784)
-- Name: Entity; Type: TABLE; Schema: public; Owner: postgres

CREATE TABLE public."Entity" (
id integer NOT NULL,
frist_name character varying(50) NOT NULL,
last_name character varying(50),
email character varying(255),
birthday date
);

ALTER TABLE public."Entity" OWNER TO postgres;

--
-- TOC entry 185 (class 1259 OID 30782)
-- Name: Entity_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres

CREATE SEQUENCE public."Entity_id_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER TABLE public."Entity_id_seq" OWNER TO postgres;

--
-- TOC entry 2151 (class 0 OID 0)
-- Dependencies: 185
-- Name: Entity_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres

ALTER SEQUENCE public."Entity_id_seq" OWNED BY public."Entity".id;

--
-- TOC entry 188 (class 1259 OID 30792)
-- Name: Team; Type: TABLE; Schema: public; Owner: postgres

CREATE TABLE public."Team" (
id integer NOT NULL,
description character varying(255) NOT NULL,
team_leader_entity_id integer NOT NULL
);

ALTER TABLE public."Team" OWNER TO postgres;

--
-- TOC entry 189 (class 1259 OID 30798)
-- Name: Team_and_Entity; Type: TABLE; Schema: public; Owner: postgres

CREATE TABLE public."Team_and_Entity" (
team_id integer NOT NULL,
entity_id integer NOT NULL
);

ALTER TABLE public."Team_and_Entity" OWNER TO postgres;

--
-- TOC entry 187 (class 1259 OID 30790)
-- Name: Team_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres

CREATE SEQUENCE public."Team_id_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER TABLE public."Team_id_seq" OWNER TO postgres;

--
-- TOC entry 2152 (class 0 OID 0)
-- Dependencies: 187
-- Name: Team_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres

ALTER SEQUENCE public."Team_id_seq" OWNED BY public."Team".id;

--
-- TOC entry 2015 (class 2604 OID 30787)
-- Name: Entity id; Type: DEFAULT; Schema: public; Owner: postgres

ALTER TABLE ONLY public."Entity" ALTER COLUMN id SET DEFAULT nextval('public."Entity_id_seq"'::regclass);

--
-- TOC entry 2016 (class 2604 OID 30795)
-- Name: Team id; Type: DEFAULT; Schema: public; Owner: postgres

ALTER TABLE ONLY public."Team" ALTER COLUMN id SET DEFAULT nextval('public."Team_id_seq"'::regclass);

--
-- TOC entry 2018 (class 2606 OID 30789)
-- Name: Entity Entity_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres

ALTER TABLE ONLY public."Entity"
ADD CONSTRAINT "Entity_pkey" PRIMARY KEY (id);

--
-- TOC entry 2023 (class 2606 OID 30802)
-- Name: Team_and_Entity Team_and_Entity_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres

ALTER TABLE ONLY public."Team_and_Entity"
ADD CONSTRAINT "Team_and_Entity_pkey" PRIMARY KEY (team_id, entity_id);

RadZen Build Error

radzen: Generating code ...
radzen: Code generation done in 543ms.
dotnet: Data\DtmsContext.cs(39,72): error CS1061: 'Team' does not contain a definition for 'entity_id' and no accessible extension method 'entity_id' accepting a first argument of type 'Team' could be found (are you missing a using directive or an assembly reference?) [C:\Users\pedro.raposo\Documents\RADZen\teste\server\project.csproj]

dotnet:

dotnet: The build failed. Please fix the build errors and run again.

PS: The same schema made in MSSQL works fine, and for version 2.12.2 this error does not occur. Also the relationship field name should be independent of the table name.

The error does not occur with the old version of Radzen since complex foreign keys were not supported at that time. You have misspelled field name in relation with complex foreign key.

Hi Enchev, can you elaborate on that based on the last example since the relationship between "Team" and "Entity" in the field "team_leader_entity_id". This example was given to me by the DB developer.

Best Regards

The relations are different. I'll recheck once again to see if foreign keys are retrieved properly in PostgreSQL data source and I'll post my findings. In the meantime you can use the old version of Radzen.

Ok. I have to admit that indeed foreign keys are not retrieved properly in some situations in PostgreSQL data source. We will release fix immediately!

Thank you for the reply