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

Custom schema #1 #38

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

Conversation

sveinhelge
Copy link

Support for custom schema. Uses schema from context.

Example:
public class MyCustomSchemaDbContext : DbContext
{
public DbSet Foos { get; set; }

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    modelBuilder.HasDefaultSchema("myschema");
    base.OnModelCreating(modelBuilder);
}

}

Will create Enum tables under schema myschema.

@timabell
Copy link
Owner

Thanks, will look over this as soon as I get a chance

@timabell
Copy link
Owner

I think it makes sense to get the description PR done before getting into this one.

@dirq
Copy link

dirq commented Jan 6, 2016

I'd love to set a custom schema. Any status on this pull?

@timabell
Copy link
Owner

timabell commented Jan 6, 2016

busy year... I haven't had a chance and I'm not sure when I'll get the time. I'd be interested to know if you manage to build and run the fork and if it works for you. I will come back to this but can't promise when. I'm a contractor so my time comes and goes somewhat randomly. I do intend to come back and make further improvements and this is still one I'd like to do.

I'm not sure how the impending EF7 will affect this project and haven't had time to look into that yet.

Still want to do PR #33 first.

@eoincgreenfinch
Copy link

hey @timabell great little tool. Just wondering if you're planning to merge this PR in, or would I be better of just forking it and building it myself. Cheers.

hey @sveinhelge don't suppose you've already published this elsewhere ?

return sql.ToString();
}

private string AddForeignKeys(IEnumerable<EnumReference> refs)
private string AddForeignKeys(LookupDbModel model)
Copy link
Owner

Choose a reason for hiding this comment

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

I'm uneasy about expanding the params to be the whole model, makes it harder to see what this method actually depends on. I need to give it some more thought.

DELETE
;"
, TableName(lookup.Name)));
MERGE INTO [{1}].[{0}] dst
Copy link
Owner

Choose a reason for hiding this comment

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

this was intentionally not indented to avoid unnecessary whitespace in the generated output

using NUnit.Framework;

[TestFixture]
public class ModelCustomSchemaParsingTests
Copy link
Owner

Choose a reason for hiding this comment

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

I'm uneasy about this test being a copy-paste of the original, smells of DRY

@@ -23,6 +23,7 @@ public class EnumExample
public void Setup()
{
Database.SetInitializer(new DropCreateDatabaseAlways<MyDbContext>());
Database.SetInitializer(new DropCreateDatabaseAlways<MyCustomSchemaDbContext>());
Copy link
Owner

Choose a reason for hiding this comment

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

I wouldn't add the custom schema to the example usage as that's a more advanced feature, and less commonly used so might confuse people new to it. The example usage is intended to be a kind of quickstart.

@timabell
Copy link
Owner

timabell commented May 9, 2017

@eoincgreenfinch I certainly would like to get this enhancement tidied up tested and merged, I'd need to find some time to set up my dev environment and work on it for a bit.

On the off-chance are you using it for a commercial project? Would you be interested in funding some development time to get it in? I'm starting to think about offering to work on open source projects for money where they are useful as I'd like to do more on them, and that would allow me to justify spending my time on it. (I'm a contract dev so I have to balance this stuff with paid work and home-life).

@timabell
Copy link
Owner

Maybe crowd-funding would work if several people/organisations would like to see this implemented? Thoughts?

@timabell
Copy link
Owner

timabell commented Jun 3, 2017

Another PR for this: #57
See also issue #58

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.

4 participants