AnantLabs / codesmith

Automatically exported from code.google.com/p/codesmith
1 stars 0 forks source link

Error: PLINQO for EF gives errors on self referencing tables #641

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Point PLINQO EF at database with a table that has a self join
2. Genereate the data model
3. Try to query data from the database (or if using MVC, try generating a 
controller from the model using the EF templates)

What is the expected output? What do you see instead?

You get an error

The number of members in the conceptual type '[table with self join]' does not 
match with the number of members on the object side type '[table with self 
join]'. Make sure the number of members are the same.

What version of the product are you using?
Latest release

Please provide any additional information below.

Original issue reported on code.google.com by MikeFox...@gmail.com on 16 Apr 2012 at 1:23

GoogleCodeExporter commented 9 years ago
Here's a sql script. Create a 1 table database with this table, and try to 
build an mvc scaffolded controller using this table.

USE [PLINQOTest]
GO

/****** Object:  Table [dbo].[Project]    Script Date: 04/16/2012 09:55:29 
******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Project](
    [ProjectId] [int] IDENTITY(1,1) NOT NULL,
    [ParentProjectId] [int] NULL,
 CONSTRAINT [PK_Project] PRIMARY KEY CLUSTERED 
(
    [ProjectId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, 
ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Project]  WITH CHECK ADD  CONSTRAINT [FK_Project_Project] 
FOREIGN KEY([ParentProjectId])
REFERENCES [dbo].[Project] ([ProjectId])
GO

ALTER TABLE [dbo].[Project] CHECK CONSTRAINT [FK_Project_Project]
GO

Original comment by MikeFox...@gmail.com on 16 Apr 2012 at 2:57

GoogleCodeExporter commented 9 years ago
Hello,

This should be fixed in revision 2618. Can you please download the latest 
nightly build (http://community.codesmithtools.com/nightly/) and see if you can 
reproduce this issue.

Please make sure to unblock the downloaded zip file.

Original comment by bniemyjski on 19 Apr 2012 at 7:26