name="msvalidate.01" content="439BE949614BBF57E29AEDBC5087737D" /> learning sql server

Selasa, 02 Juni 2009

Policy-Based Management Objects
Policy-Based Management uses fi ve different objects to manage policies: facets, conditions,
policies, targets, and categories.
Facets
Facets are the base units of this framework. Facets are types of objects, such as a Surface
Area feature, server, logon, database, user, and so on. Each facet has a set of predefi ned
properties against which conditions can be created.
As of the Community Technology Preview 6 (CTP6) release, there are a total of 47 facets, with
a whopping 1,492 total properties. SQL Server Management Studio has a list of these facets
under the Facets node in Objects Explorer (found under Management, Policy Management).
Alas, if you want to see each list of properties, you need to open each facet’s properties individually.
If you want a quick list of all facets and properties, however, you can use the SQL
Server Management Objects (SMO) to iterate through all available facets and properties, as
shown here:
FacetInfoCollection fic = PolicyStore.Facets;
IEnumerable fic_sorted = from fic_i in fic
orderby fic_i.DisplayName
select fic_i;
Int32 pcount;
foreach (FacetInfo fi in fic_sorted)
{
Console.WriteLine(“FACET: “ + fi.DisplayName);
IEnumerable fi_sorted = from fi_i in fi.FacetProperties
orderby fi_i.Name
select fi_i;
pcount = 0;
foreach (PropertyInfo pi in fi_sorted)
{
if (pcount++ > 0)
Console.Write(“, “ + pi.Name);
else
Console.Write(pi.Name);
}
Console.WriteLine();
Console.ReadLine();
}
Console.WriteLine(“---End of List---”);
Console.ReadLine();
FacetInfoCollection fic = PolicyStore.Facets;
IEnumerable fic_sorted = from fic_i in fic
orderby fic_i.DisplayName
select fic_i;
Int32 pcount;
foreach (FacetInfo fi in fic_sorted)
{
Console.WriteLine(“FACET: “ + fi.DisplayName);
IEnumerable fi_sorted = from fi_i in fi.FacetProperties
orderby fi_i.Name
select fi_i;
pcount = 0;
foreach (PropertyInfo pi in fi_sorted)
{
if (pcount++ > 0)
Console.Write(“, “ + pi.Name);
else
Console.Write(pi.Name);
}
Console.WriteLine();
Console.ReadLine();
}
Console.WriteLine(“---End of L

Tidak ada komentar:

Posting Komentar