My favorites | Sign in
Project Logo
       
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// FacebookSection.cs
// Facebook/FrameworkWeb/Web
// Copyright (c) 2007, Nikhil Kothari. All Rights Reserved.
//

using System;
using System.Configuration;
using System.Diagnostics;
using System.Web.Configuration;

namespace Facebook.Web.Configuration {

/// <summary>
/// Represents the Facebook configuration section which contains settings for
/// Facebook applications.
/// </summary>
public sealed class FacebookSection : ConfigurationSection {

private static readonly ConfigurationProperty ApplicationsProperty =
new ConfigurationProperty("", typeof(FacebookApplicationSettingsCollection), null,
ConfigurationPropertyOptions.IsDefaultCollection);

private static ConfigurationPropertyCollection AllProperties = BuildProperties();

private static FacebookSection SectionInstance;

/// <summary>
/// The list of applications defined in configuration.
/// </summary>
[ConfigurationProperty("", IsDefaultCollection = true)]
public FacebookApplicationSettingsCollection Applications {
get {
return (FacebookApplicationSettingsCollection)base[ApplicationsProperty];
}
}

/// <internalonly />
protected override ConfigurationPropertyCollection Properties {
get {
return AllProperties;
}
}

private static ConfigurationPropertyCollection BuildProperties() {
ConfigurationPropertyCollection props = new ConfigurationPropertyCollection();
props.Add(ApplicationsProperty);
return props;
}

private static void EnsureSection() {
if (SectionInstance == null) {
SectionInstance = (FacebookSection)WebConfigurationManager.GetSection("facebook");
if (SectionInstance == null) {
SectionInstance = new FacebookSection();
}
}
}

/// <summary>
/// Gets the application.
/// </summary>
/// <param name="name">The name.</param>
/// <returns></returns>
public static FacebookApplicationSettings GetApplication(string name) {
EnsureSection();
return SectionInstance.Applications[name];
}

internal static FacebookApplicationSettingsCollection GetApplications() {
EnsureSection();
return SectionInstance.Applications;
}
}
}
Show details Hide details

Change log

r21 by nberardi on Jun 06, 2008   Diff
[No log message]
Go to: 

Older revisions

All revisions of this file

File info

Size: 2581 bytes, 74 lines
Hosted by Google Code