EfSchemaCompare icon indicating copy to clipboard operation
EfSchemaCompare copied to clipboard

group on schema; add table_owner; fix more than one property

Open BartNetJS opened this issue 6 years ago • 7 comments

group on schema and table name to avoid duplicates when more schema's has the same table name; add table_owner to GetPrimaryKeysNames to get pk's from other scheam's than dbo; fix returning more than one property on GetProperties when inherited classes with same property names

BartNetJS avatar Feb 28 '19 16:02 BartNetJS

@JonPSmith can you review below?

image

Maybe there is a beter way to retrieve only the inherited properties that are not overridden from the base class.

The issue above happens when the inherited class has a property that is also in the base class.

For example:

abstract class A { public string someField { get; set; }; }

class B : A { public new int? someField { get; set; }; }

The GetProperties will return the 2 fields, and SingleOrDefault will fail.

BartNetJS avatar Feb 28 '19 16:02 BartNetJS

Hi @BartNetJS,

I can see what you are trying to do with the schema - I had to make the same change to the EfSchemaCompare equivalent for EF Core. What I would say is you should add some unit tests - my tests allow you to fake the SQL part (see Test42MockCompareSqlSql), which makes testing easier. I wouldn't want to merge anything in unless a) the current tests pass and b) you have tests for the new code.

The GetPublicAndPrivatePropertiesByName is another issue entirely. It seems so unusual, as from the compiler's point of view the class B property hides the class A property of the same name (but not from reflection). I wouldn't bother myself but I assume you have a a situation like this in your code - correct?

JonPSmith avatar Feb 28 '19 19:02 JonPSmith

Hi @JonPSmith

I can't run the unit tests in VS2017 latest version. I have installed NUnit 3 Test adapter but got the following message " No test matches the given testcase filter"

image

Any idea?

BartNetJS avatar Mar 01 '19 16:03 BartNetJS

Hi Bart,

I run my unit tests using Resharper, which works, but I agree that the Test Explorer doesn't work. I found this StackOverflow answer and I installed the NuGet package but it still didn't work.

You might like to install VS tool mentioned in the SO answer (I didn't want to load that as I don't need it). Maybe that will work.

JonPSmith avatar Mar 01 '19 16:03 JonPSmith

@JonPSmith I don't get the unit tests working. Are you able to fix those issues?

BartNetJS avatar Mar 04 '19 16:03 BartNetJS

Hi @BartNetJS,

Sorry, but I have two contracts running at the moment and I just don't have the time to look at this. You might like to try VS2015, which is what the code was created on.

JonPSmith avatar Mar 05 '19 08:03 JonPSmith

Hi @BartNetJS,

I had a thought - the code was developed in VS2015. I added the NUnitTestAdapter NuGet package and I can now run unit tests from the Test Explorer in VS2015, but not in VS2017. Try that.

JonPSmith avatar Mar 09 '19 11:03 JonPSmith