PetaPoco icon indicating copy to clipboard operation
PetaPoco copied to clipboard

Methods/properties missing from IDatabase

Open asherber opened this issue 5 years ago • 5 comments

There appear to be some public methods and properties of Database which are missing from IDatabase (and from any of the other interfaces which IDatabase implements). I wasn't sure if this was intentional or not; I ran into it because IDatabaseBuildConfiguration.Create() returns an IDatabase, and I noticed that there were some things I couldn't do.

// These should be accessible from the interface
Connection property
KeepConnectionAlive property
CreateCommand();

// These two should probably be marked protected instead of public.
// They're part of the plumbing -- are there times when a user should call them directly?
OpenSharedConnection()
CloseSharedConnection()

// This one seems like it might be protected or private instead of public,
// otherwise add to interface.
FormatCommand()

// These should probably be protected, since they're only used by Database 
// descendants, not called directly.
OnBeginTransaction() and friends

asherber avatar Jan 02 '19 20:01 asherber

Good eye. We should fix this.

pleb avatar Apr 11 '19 03:04 pleb

I'm happy to put together a PR if you let me know which way you'd like to go. Note that moving some public methods to protected or private, as I suggest, is a breaking change, even if it might be better design. For that matter, adding methods to an interface is also a breaking change for anyone who has made their own object to implement IDatabase.

asherber avatar Apr 11 '19 11:04 asherber

Yeah, true. Ok, then we should bump the version to 6.1

pleb avatar Apr 14 '19 08:04 pleb

(Under sematic versioning, probably 6.1 should have been when stored procs were added, and 6.2 should be async. A breaking change would mean 7.0.)

asherber avatar Apr 18 '19 20:04 asherber

Happy to roll version 7

pleb avatar Apr 25 '19 10:04 pleb