クラス同士の関連を出力できるようにしました。
上の図が出力に使用したプログラムを出力したものです。
ざっくりとしたイメージを把握する程度の要求は満たせるかな、という感じです。
class MyPage : Page {
protected void Page_PreRender(object sender, EventArgs e) {
var args = "xxx"; // 例えば、詳細情報を表示するためのプライマリキー
var js = ClientScript.GetPostBackEventReference(this, args);
Table1.Rows[0].Cells[0].Attributes.Add("onclick", js);
}
}
// 上のクラスへIPostBackEventHandlerを実装
class MyPage : Page, IPostBackEventHandler {
...
public void RaisePostBackEvent(string eventArgs) {
// 例えばセッションへeventArgsをセットして詳細ページへ遷移する
Session.Add("key", eventArgs);
var detail = ResolveUrl("~/MyDetailPage.aspx");
Server.Transfer(detail);
}
}
var path = VirtualPathUtility.Combine(HttpRuntime.AppDomainVirtualPath,
"Web.config");
var conf = WebConfigurationManager.OpenWebConfiguration(path);
class NetworkConfigurationSection : ConfigurationSection
{
[ConfigurationProperty("LocalHost")]
public NetworkConfigElement LocalHost
{
get { return base["LocalHost"] as NetworkConfigElement; }
set { base["LocalHost"] = value; }
}
[ConfigurationProperty("Networks")]
public NetworkConfigElementCollection Networks
{
get { return base["Networks"] as NetworkConfigElementCollection; }
}
}
class NetworkConfigElement : ConfigurationElement
{
[ConfigurationProperty("IPAddress")]
public string IPAddress
{
get { return base["IPAddress"] as string; }
set { base["IPAddress"] = value; }
}
}
class NetworkConfigElementCollection : ConfigurationElementCollection
{
protected override ConfigurationElement CreateNewElement()
{
return new NetworkConfigElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
NetworkConfigElement elm = element as NetworkConfigElement;
if (null == elm) return null;
return elm.IPAddress;
}
}
class HelloCmd(cmd.Cmd): ...
def do_hello(self, arg):
print 'hello, ' + str(arg)
>>> HelloCmd().cmdloop() (Cmd) hello Taro Hello, Taro (Cmd) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.7/cmd.py", line 130, in cmdloop line = raw_input(self.prompt) KeyboardInterrupt
public interface DataReader {
Data readData(DataSource dataSource);
}
public class DatabaseDataReader implements DataReader {
private final ConnectionManager connectionManager;
@Inject
public DatabaseDataReader(
ConnectionManager connectionManager) {
this.connectionManager = connectionManager;
}
@Override
public Data readData(DataSource dataSource) {
// ... read data from the database
return Data.of(readInData, someMetaData);
}
}