Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for EF models with different schemas #57

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Ian1971
Copy link

@Ian1971 Ian1971 commented May 31, 2017

Our EF model contained a couple of schemas. I think this pull request is a relatively simple change to support them.

Copy link
Owner

@timabell timabell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to be picky, but this is a bit of a showcase project for me.
It'll be interesting to compare this with PR #38
If you want this moved on faster than my limited free time allows then consider issue #58

@@ -10,14 +10,15 @@ namespace EfEnumToLookup.LookupGenerator
[DebuggerDisplay("{DebuggerDisplay,nq}")]
internal class EnumReference
{
public string ReferencingTable { get; set; }
public string ReferencingTable { get; set; }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace error - format the file before committing

public Type EnumType { get; set; }

// ReSharper disable once UnusedMember.Local
private string DebuggerDisplay
{
get { return string.Format("EnumReference: {0}.{1} ({2})", ReferencingTable, ReferencingField, EnumType.Name); }
get { return string.Format("EnumReference: {3}.{0}.{1} ({2})", ReferencingTable, ReferencingField, EnumType.Name, ReferencingSchema); }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-order these for readability, or better still convert to the new interpolated string format. I might do a separate commit to use interpolation everywhere

@@ -53,15 +53,17 @@ private static IEnumerable<EnumReference> ProcessEdmProperties(IEnumerable<EdmPr
// get mapped table name from mapping, or fall-back to just the name if no mapping is set,
// I have no idea what causes Table to be null, and I have no unit test for it yet, but I have seen it.
var table = mappingFragment.StoreEntitySet.Table ?? mappingFragment.StoreEntitySet.Name;

foreach (var edmProperty in properties)
var schema = mappingFragment.StoreEntitySet.Schema ?? "dbo";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incorrect indentation - this project uses tabs. Think there's an editorconfig file, if not there should be. http://editorconfig.org/

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defaulting to 'dbo' might cause problems with implementing non-sql-server variants (which have been requested). probably better to leave it unqualified if no schema present

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see issue #44

This was referenced Jun 3, 2017
@ExcelDataReader
Copy link

I'll be pushing changes shortly. With regard to #38. That is all about setting the schema of the created lookup tables, whereas as this is about matching the schema of existing tables for use in the foreign keys. So similar sounding, but not really related.

@timabell
Copy link
Owner

timabell commented Jun 5, 2017

Ah you're right. So only related in that they both add multischema capabilities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants