问题描述
是否可以测试数据库是否托管在SQL Azure上?我正在查看EF6的SqlAzureExecutionStrategy,仅在数据库实际上是SQL Azure数据库的情况下才想应用.
Is it possible to test whether a database is hosted on SQL Azure? I am looking at SqlAzureExecutionStrategy for EF6 and only want to apply if the database is actually SQL Azure database.
当前,我正在测试App是否在Azure中运行.但是,我们正在考虑允许客户端自己托管数据库,从而希望通过某种方式来识别数据库是SQL Server还是Azure SQL.
Currently I am testing if App is running within Azure. However we are looking at allowing clients to host DB themselves so would like some way to identify if DB is a SQL Server or Azure SQL.
假设EF不会知道,因为它正在隐藏实施细节.
Assume EF won't know as it is hiding the implementation details.
我想可能只有一个配置设置.只是想知道这在技术上是否可行.
Could just have a config setting I guess. Just wondered if it was technically possible.
推荐答案
SELECT CASE ServerProperty('EngineEdition')
WHEN 1 THEN 'Personal'
WHEN 2 THEN 'Standard'
WHEN 3 THEN 'Enterprise'
WHEN 4 THEN 'Express'
WHEN 5 THEN 'Azure'
ELSE 'Unknown'
END
http://technet.microsoft.com/en-us/library/ms174396.aspx
这篇关于如何测试数据库是否托管在SQL Azure上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!