Repository pattern using PowerShell -
here concern,
my problem not powershell, way have use implement persistence. cases there more 4 commands logic or apply persistence.
for example:
when configuring dns zone, normal new/get/set/remove-dnszone and suspend/unsuspend-dnszone. how teammates handling make method on repository handle commands.
it seems me behavior should instead on object , suspend/unsuspend-dnszone should called when create or update executed on repo.
what think?
edit requested, i'll put code demonstrate talking about.
this fake example similar implementation of our powershell wrapper. method on repository teammates do:
public void suspend(dnszone zone) { _powershell.execute("suspend-zone", new dictionary<string, object>{{"name", zone.name}}); }
so somewhere in logic, suspend zone have call
var myzone = new dnszone{ name= "xyz"}; _zones.suspend(myzone);
instead, prone dnszone should have property or method. logic not in repo in object itself. though repo has translate suspend-zone call.
var myzone = _zones.findbyname("nyname"); myzone.suspend(); _zones.save(myzone);
hth
it seems doing break lot of pipelining functionality makes powershell easy use comnmand line. if eliminated suspend-dnszone cmdlet in favor of object method, couldn't do
get-dnszone | suspend-dnszone
you'd have
get-dnszone | foreach-object {$_.suspend()}
not improvement, imho.
Comments
Post a Comment