Skip to content

[Bug] Issue when EnableSchemaFolder and linking tables across schema #164

@skuami

Description

@skuami

Describe the bug
Model classes are not recognized when EnableSchemaFolder is enabled. This occures when a constraint is configured on the database between tables in different schemas.
The namespaces for references tables in different schemas are missing:

image

There is also an issues on the context:
image

To Reproduce
I used the sample project from the git repo and created the northwind database with the provided SQL script.
In sql management studio I created a new schema called "app" and created a table TestTable (see screenshot).
Finally I linked the app.TestTable and dbo.Employee tables.

image

Make My Life Easier
I didn't change any code on the sample app - so no PR provided. ;-)
EDIT: To make your life easier, I wrote the SQL script to create the schema, table and relation:

USE [NorthwindSlim]
GO

CREATE SCHEMA App;  
GO

CREATE TABLE App.TestTable
	(
	Id int NOT NULL IDENTITY (1, 1),
	Name nvarchar(50) NOT NULL,
	EmployeeId int NOT NULL
	)  ON [PRIMARY]
GO
ALTER TABLE App.TestTable ADD CONSTRAINT
	PK_TestTable PRIMARY KEY CLUSTERED 
	(
	Id
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO

ALTER TABLE App.TestTable ADD CONSTRAINT
	FK_TestTable_Employee FOREIGN KEY
	(
	EmployeeId
	) REFERENCES dbo.Employee
	(
	EmployeeId
	) ON UPDATE  CASCADE 
	 ON DELETE  CASCADE 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions