I'll preface this question by saying this is for a Microsoft only shop.
我将在这个问题的序言中说这是微软唯一的商店。
If you were to write a console app to manage a data warehouse what would you use:
1) Writing a custom environment for PowerShell (ala the latest flavors of Exchange / SQL Server)
2) Write it as a C# Console App
如果您要编写一个控制台应用程序来管理数据仓库,您将使用以下内容:1)为PowerShell编写自定义环境(ala最新版本的Exchange / SQL Server)2)将其写为C#控制台应用程序
If #2 are there any frameworks that offload writing a "menu system" or any other tasks for you.
如果#2有任何框架可以卸载为您编写“菜单系统”或任何其他任务。
If this app needed to last 6 to 8 years - would you use PowerShell? No one on the team currently has PowerShell experience, but we are quick learners.
如果这个应用程序需要持续6到8年 - 你会使用PowerShell吗?团队中没有人目前拥有PowerShell经验,但我们是快速学习者。
5 个解决方案
#1
5
If you write your management functionality as PowerShell cmdlets, then you can surface that functionality either by letting people run cmdlets directly, or by wrapping them in a GUI. Going with PowerShell probably gives you the most long-term flexibility, and as MS implements more PowerShell cmdlets, it means that managing your data warehouse could be incorporated with other, larger business processes if necessary. I would probably NOT choose to write a C# console app - but I have a distinctly more "administrator" perspective. We admins are tired of having custom console apps tossed at us - the idea of PowerShell is to standardize everything in a way that supports both command-line and GUI administration.
如果将管理功能编写为PowerShell cmdlet,则可以通过让人们直接运行cmdlet或将它们包装在GUI中来显示该功能。使用PowerShell可能会为您提供最长期的灵活性,并且随着MS实施更多PowerShell cmdlet,这意味着如有必要,可以将管理数据仓库与其他更大的业务流程合并。我可能不会选择编写一个C#控制台应用程序 - 但我有一个明显更“管理员”的视角。我们的管理员已经厌倦了向我们抛出自定义控制台应用程序 - PowerShell的想法是以支持命令行和GUI管理的方式标准化所有内容。
#2
1
I think you can be successful with both, and should be able to switch between the two without too much hassle. If you start out building a console app but learn PowerShell later, you can throw away a lot of the console app-specific code (command-line parsing code for example) and build a few PowerShell cmdlets to wrap your existing API. Or, if you build a bunch of Cmdlets out the gate, but need to switch to a console app later, you won't have wasted much time writing the Cmdlets.
我认为你们两个都可以成功,并且应该能够在两者之间切换而不会有太多麻烦。如果您开始构建控制台应用程序但稍后学习PowerShell,则可以丢弃许多特定于控制台应用程序的代码(例如命令行解析代码),并构建一些PowerShell cmdlet来包装现有API。或者,如果您在门外构建了一堆Cmdlet,但稍后需要切换到控制台应用程序,那么编写Cmdlet就不会浪费太多时间。
So, I don't really have strong advice one way or another. I will say: hey, go try PowerShell. If you don't like it, it's not too difficult to switch.
所以,我真的没有这种或那种强烈的建议。我会说:嘿,去尝试PowerShell。如果您不喜欢它,切换起来并不困难。
#3
1
I have found that PowerShell is a much more maintainable solution for smaller things. Console apps require relinking into new libraries and recompiling and redistributing out when the libraries you depend on change (in my case going from Visual Studio 2005 - Visual Studio 2008's codecoverage and other things) as well as executables your scripts may call vsinstr, mstest, etc. where as with PowerShell scripts you can easily customize for each environment you have and don't have to go through the compile, link, deploy stuff for every environment you choose. In fact if you get your path info from the registry the same script can run in both environments.
我发现PowerShell是一种更易于维护的小型解决方案。控制台应用程序需要重新链接到新库并重新编译和重新分发,当您依赖的库发生更改时(在我的情况下从Visual Studio 2005 - Visual Studio 2008的代码覆盖和其他事情)以及脚本可能调用vsinstr,mstest等的可执行文件与PowerShell脚本一样,您可以轻松地为每个环境进行自定义,而不必为您选择的每个环境进行编译,链接和部署。实际上,如果从注册表中获取路径信息,则可以在两个环境中运行相同的脚本。
You can do everything you want with either, I just prefer having to maintain a single simple text file, then a console app. Just personal preference.
你也可以做任何你想做的事情,我只想维护一个简单的文本文件,然后是控制台应用程序。只是个人喜好。
#4
0
When you are saying manage a data warehouse, what kind of tasks are you talking about?
当您说管理数据仓库时,您在谈论什么样的任务?
Much of the management I would do in T-SQL (purging, archiving, transforming) - the interface to that can be very thin (even non-existent).
我将在T-SQL(清除,存档,转换)中进行的大部分管理 - 接口可能非常薄(甚至不存在)。
OK, based on your comment I would have the code which does all the work in a stored procs with a .NET assembly (typical API class library), as much in stored procs as possible, with the assembly for stuff which is easier done there or which requires COM or whatever. I would then either wrap the class library in cmdlets or just call the .NET objects from PowerShell (remember that PowerShell can instantiate objects.).
好的,基于你的评论,我将拥有代码,它可以在存储过程中使用.NET程序集(典型的API类库)完成所有工作,尽可能多地在存储过程中使用程序集,这样在那里更容易完成或需要COM或其他什么。然后我会将类库包装在cmdlet中,或者只是从PowerShell调用.NET对象(请记住,PowerShell可以实例化对象。)。
Now you have a .NET library which can also be called from web pages, GUI apps, whatever, if you ever want it, and you have a cmdlet and a direct .NET interface - plus the option of calling them from SQL if they are fully implemented at the SQL layer.
现在你有了一个.NET库,它也可以从网页,GUI应用程序中调用,无论如何,如果你需要它,你有一个cmdlet和一个直接的.NET接口 - 如果它们是你可以选择从SQL调用它们完全在SQL层实现。
#5
0
The beauty of implementing PowerShell instead of a cosole app is that you don't have to code all the parameter parsing or all the formatting. PowerShell takes care of all of that for you. You can, of course, override defaults if you need to. You can get wildcards for free. You can also have your Cmdlet(s) take values from the pipeline which opens up all kinds of possibilities and uses for automation. With PowerShell, both the end user and the developer will have a much better experience.
实现PowerShell而不是cosole应用程序的美妙之处在于您不必编写所有参数解析或所有格式的代码。 PowerShell为您完成所有这些工作。当然,如果需要,您可以覆盖默认值。你可以免费获得通配符。您还可以让您的Cmdlet从管道中获取值,从而为自动化开辟了各种可能性和用途。使用PowerShell,最终用户和开发人员都将获得更好的体验。
#1
5
If you write your management functionality as PowerShell cmdlets, then you can surface that functionality either by letting people run cmdlets directly, or by wrapping them in a GUI. Going with PowerShell probably gives you the most long-term flexibility, and as MS implements more PowerShell cmdlets, it means that managing your data warehouse could be incorporated with other, larger business processes if necessary. I would probably NOT choose to write a C# console app - but I have a distinctly more "administrator" perspective. We admins are tired of having custom console apps tossed at us - the idea of PowerShell is to standardize everything in a way that supports both command-line and GUI administration.
如果将管理功能编写为PowerShell cmdlet,则可以通过让人们直接运行cmdlet或将它们包装在GUI中来显示该功能。使用PowerShell可能会为您提供最长期的灵活性,并且随着MS实施更多PowerShell cmdlet,这意味着如有必要,可以将管理数据仓库与其他更大的业务流程合并。我可能不会选择编写一个C#控制台应用程序 - 但我有一个明显更“管理员”的视角。我们的管理员已经厌倦了向我们抛出自定义控制台应用程序 - PowerShell的想法是以支持命令行和GUI管理的方式标准化所有内容。
#2
1
I think you can be successful with both, and should be able to switch between the two without too much hassle. If you start out building a console app but learn PowerShell later, you can throw away a lot of the console app-specific code (command-line parsing code for example) and build a few PowerShell cmdlets to wrap your existing API. Or, if you build a bunch of Cmdlets out the gate, but need to switch to a console app later, you won't have wasted much time writing the Cmdlets.
我认为你们两个都可以成功,并且应该能够在两者之间切换而不会有太多麻烦。如果您开始构建控制台应用程序但稍后学习PowerShell,则可以丢弃许多特定于控制台应用程序的代码(例如命令行解析代码),并构建一些PowerShell cmdlet来包装现有API。或者,如果您在门外构建了一堆Cmdlet,但稍后需要切换到控制台应用程序,那么编写Cmdlet就不会浪费太多时间。
So, I don't really have strong advice one way or another. I will say: hey, go try PowerShell. If you don't like it, it's not too difficult to switch.
所以,我真的没有这种或那种强烈的建议。我会说:嘿,去尝试PowerShell。如果您不喜欢它,切换起来并不困难。
#3
1
I have found that PowerShell is a much more maintainable solution for smaller things. Console apps require relinking into new libraries and recompiling and redistributing out when the libraries you depend on change (in my case going from Visual Studio 2005 - Visual Studio 2008's codecoverage and other things) as well as executables your scripts may call vsinstr, mstest, etc. where as with PowerShell scripts you can easily customize for each environment you have and don't have to go through the compile, link, deploy stuff for every environment you choose. In fact if you get your path info from the registry the same script can run in both environments.
我发现PowerShell是一种更易于维护的小型解决方案。控制台应用程序需要重新链接到新库并重新编译和重新分发,当您依赖的库发生更改时(在我的情况下从Visual Studio 2005 - Visual Studio 2008的代码覆盖和其他事情)以及脚本可能调用vsinstr,mstest等的可执行文件与PowerShell脚本一样,您可以轻松地为每个环境进行自定义,而不必为您选择的每个环境进行编译,链接和部署。实际上,如果从注册表中获取路径信息,则可以在两个环境中运行相同的脚本。
You can do everything you want with either, I just prefer having to maintain a single simple text file, then a console app. Just personal preference.
你也可以做任何你想做的事情,我只想维护一个简单的文本文件,然后是控制台应用程序。只是个人喜好。
#4
0
When you are saying manage a data warehouse, what kind of tasks are you talking about?
当您说管理数据仓库时,您在谈论什么样的任务?
Much of the management I would do in T-SQL (purging, archiving, transforming) - the interface to that can be very thin (even non-existent).
我将在T-SQL(清除,存档,转换)中进行的大部分管理 - 接口可能非常薄(甚至不存在)。
OK, based on your comment I would have the code which does all the work in a stored procs with a .NET assembly (typical API class library), as much in stored procs as possible, with the assembly for stuff which is easier done there or which requires COM or whatever. I would then either wrap the class library in cmdlets or just call the .NET objects from PowerShell (remember that PowerShell can instantiate objects.).
好的,基于你的评论,我将拥有代码,它可以在存储过程中使用.NET程序集(典型的API类库)完成所有工作,尽可能多地在存储过程中使用程序集,这样在那里更容易完成或需要COM或其他什么。然后我会将类库包装在cmdlet中,或者只是从PowerShell调用.NET对象(请记住,PowerShell可以实例化对象。)。
Now you have a .NET library which can also be called from web pages, GUI apps, whatever, if you ever want it, and you have a cmdlet and a direct .NET interface - plus the option of calling them from SQL if they are fully implemented at the SQL layer.
现在你有了一个.NET库,它也可以从网页,GUI应用程序中调用,无论如何,如果你需要它,你有一个cmdlet和一个直接的.NET接口 - 如果它们是你可以选择从SQL调用它们完全在SQL层实现。
#5
0
The beauty of implementing PowerShell instead of a cosole app is that you don't have to code all the parameter parsing or all the formatting. PowerShell takes care of all of that for you. You can, of course, override defaults if you need to. You can get wildcards for free. You can also have your Cmdlet(s) take values from the pipeline which opens up all kinds of possibilities and uses for automation. With PowerShell, both the end user and the developer will have a much better experience.
实现PowerShell而不是cosole应用程序的美妙之处在于您不必编写所有参数解析或所有格式的代码。 PowerShell为您完成所有这些工作。当然,如果需要,您可以覆盖默认值。你可以免费获得通配符。您还可以让您的Cmdlet从管道中获取值,从而为自动化开辟了各种可能性和用途。使用PowerShell,最终用户和开发人员都将获得更好的体验。