-
Notifications
You must be signed in to change notification settings - Fork 1
Config Document
GoodGoodMan edited this page Jan 6, 2018
·
2 revisions
ApplicationContext는 ConfigAttribute가 프로퍼티에 걸려있는 Managed클래스들에 대해 설정 값을 매핑해 주는 기능을 가지고 있다.
Config 파일은 다음과 같은 Key-Value 양식을 가진다.
key=value
key = value
...
key와 value사이의 공백은 trim되어 처리된다.
이렇게 작성된 파일은 GGMApplication@Run에 path로서 넣어준다.
GGMApplication.Run(
GetType()
, "../../../application.cfg" // 설정 파일의 위치
, new string[] { }
, typeof(ConstructorService)
, ....
);등록된 Config파일은 Dictionary<string, string>으로서 관리된다. 이후 Context가 객채를 생성할때 ConfigAttribute가 적용된 프로퍼티가 있다면 해당 프로퍼티에 적용된 Key값으로 Value를 불러온 뒤 설정값을 적용시킨다.
// TestController
[Managed(ManagedType.Singleton)]
public class TestController
{
[Config("Key")]
public string ApplicationName { get; set; }
...
}현재 GGM.Application에서 지원하는 설정파일의 자료형은 다음과 같다.
- 정수형 - int, long
- 실수형 - float, double
- 문자열 - string