-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -10,14 +10,15 @@ namespace EfEnumToLookup.LookupGenerator | |||
[DebuggerDisplay("{DebuggerDisplay,nq}")] | |||
internal class EnumReference | |||
{ | |||
public string ReferencingTable { get; set; } | |||
public string ReferencingTable { get; set; } |
There was a problem hiding this comment.
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); } |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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/
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see issue #44
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. |
Ah you're right. So only related in that they both add multischema capabilities. |
Our EF model contained a couple of schemas. I think this pull request is a relatively simple change to support them.