Views and user defined types

Views and user defined types

Postby anthonym » Wed 03 Sep 2008 15:35

Hi,

I'm doing more Entity Framework testing with the trial version (3.75.31) and I have a couple questions:

1. Are views supported? In the entity data model wizard, after I specify my connection string, I can see the views in my database. However, even if I select them, they are not added to the entity model.

2. Are user defined types supported? In my test case, I have a table with a column of type "geometry" (i.e. defined by PostGIS), but it does not show up in the model. It would be difficult to map them to anything other than strings, but that may be helpful anyways.

Thanks,
Anthony
anthonym
 
Posts: 5
Joined: Tue 26 Aug 2008 18:00

Postby Shalex » Fri 05 Sep 2008 08:28

Views are supported already. This implementation will be available in the next build.
The UDP support is not available.
Shalex
Devart Team
 
Posts: 7780
Joined: Thu 14 Aug 2008 12:44

Postby Shalex » Tue 09 Sep 2008 16:06

The latest build (3.75.32) of PostgreSQLDirect .NET is available. It supports views in EDM Wizard .
You can download it from http://www.devart.com/pgsqlnet/download.html or from Registered Users' Area (for the Subscription program members only).

More about new release: http://devart.com/forums/viewtopic.php?t=12845
Shalex
Devart Team
 
Posts: 7780
Joined: Thu 14 Aug 2008 12:44

Postby anthonym » Wed 10 Sep 2008 21:45

Thanks for the new build. Everything seems to work as expected with one exception. All columns marked as NOT NULL in the database are mapped with "Entity Key = True" in the EDM.

For example, given this table definition:

Code: Select all
CREATE TABLE myschema.table1
(
  id integer NOT NULL DEFAULT nextval('table1_id_seq'::regclass),
  field1 text NOT NULL,
  field2 text,
  field3 integer NOT NULL,
  CONSTRAINT table1_pkey PRIMARY KEY (id)
)
WITH (OIDS=FALSE);


and this view definition:

Code: Select all
CREATE OR REPLACE VIEW myschema.view1 AS
SELECT table1.id, table1.field1, table1.field2, table1.field3
   FROM table1
  WHERE table1.field3 = 1;


If I add view1 as an entity in my EDM, then "id", "field1", and "field3" will be set to "Entity Key = True". That causes a few problems, such as being unable to map those columns as associations (e.g. "field3" could be a foreign key on another table).

Regards,
Anthony
anthonym
 
Posts: 5
Joined: Tue 26 Aug 2008 18:00

Postby Shalex » Thu 18 Sep 2008 12:43

There is no support of getting real primary keys for Views in EDM Wizard even in SqlClient for MS SQL Server. We will try to implement it in the future for Views based on one table. But no time frame can be provided.
Shalex
Devart Team
 
Posts: 7780
Joined: Thu 14 Aug 2008 12:44

Postby anthonym » Thu 18 Sep 2008 19:00

Good point, that makes sense. It's not trivial to figure out which fields are keys in a view.

What if none of the fields were marked as "Entity Key = True"? That way, it would be possible to manually define all associations for that view in the EDM. It would be easier to work with than having all NOT NULL fields set that way.

Regards,
Anthony
anthonym
 
Posts: 5
Joined: Tue 26 Aug 2008 18:00


Return to dotConnect for PostgreSQL