SHOW:
|
|
- or go back to the newest paste.
| 1 | class YobaFactory: IYobaFactory | |
| 2 | {
| |
| 3 | - | public void CreateYoba(int index) |
| 3 | + | private IDatabase database; |
| 4 | ||
| 5 | - | return new Yoba { Index = index };
|
| 5 | + | public YobaFactory(IDatabase database) |
| 6 | {
| |
| 7 | this.typeDatabase = database; | |
| 8 | } | |
| 9 | ||
| 10 | public Guid RegisterType<T>() | |
| 11 | {
| |
| 12 | return typeDatabase.RegisterType(typeof(T)); | |
| 13 | } | |
| 14 | ||
| 15 | public object CreateYoba(Guid guid) | |
| 16 | {
| |
| 17 | var type = Type.GetType(database.GetTypeNameFor(guid)); | |
| 18 | return Activator.CreateInstance(type); | |
| 19 | } | |
| 20 | } |