{"action":"closed","issue":{"url":"https://api.github.com/repos/Starcounter/Starcounter/issues/2507","labels_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/2507/labels{/name}","comments_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/2507/comments","events_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/2507/events","html_url":"https://github.com/Starcounter/Starcounter/issues/2507","id":55018594,"number":2507,"title":"Add lookup methods to retreive dynamic type from class (and name)","user":{"login":"per-samuelsson","id":2902045,"avatar_url":"https://avatars.githubusercontent.com/u/2902045?v=3","gravatar_id":"","url":"https://api.github.com/users/per-samuelsson","html_url":"https://github.com/per-samuelsson","followers_url":"https://api.github.com/users/per-samuelsson/followers","following_url":"https://api.github.com/users/per-samuelsson/following{/other_user}","gists_url":"https://api.github.com/users/per-samuelsson/gists{/gist_id}","starred_url":"https://api.github.com/users/per-samuelsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/per-samuelsson/subscriptions","organizations_url":"https://api.github.com/users/per-samuelsson/orgs","repos_url":"https://api.github.com/users/per-samuelsson/repos","events_url":"https://api.github.com/users/per-samuelsson/events{/privacy}","received_events_url":"https://api.github.com/users/per-samuelsson/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Starcounter/Starcounter/labels/Code+host","name":"Code host","color":"009800"},{"url":"https://api.github.com/repos/Starcounter/Starcounter/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/Starcounter/Starcounter/labels/G%2FDynamicSchema","name":"G/DynamicSchema","color":"009800"},{"url":"https://api.github.com/repos/Starcounter/Starcounter/labels/guess%3A+hours","name":"guess: hours","color":"207de5"}],"state":"closed","locked":false,"assignee":{"login":"per-samuelsson","id":2902045,"avatar_url":"https://avatars.githubusercontent.com/u/2902045?v=3","gravatar_id":"","url":"https://api.github.com/users/per-samuelsson","html_url":"https://github.com/per-samuelsson","followers_url":"https://api.github.com/users/per-samuelsson/followers","following_url":"https://api.github.com/users/per-samuelsson/following{/other_user}","gists_url":"https://api.github.com/users/per-samuelsson/gists{/gist_id}","starred_url":"https://api.github.com/users/per-samuelsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/per-samuelsson/subscriptions","organizations_url":"https://api.github.com/users/per-samuelsson/orgs","repos_url":"https://api.github.com/users/per-samuelsson/repos","events_url":"https://api.github.com/users/per-samuelsson/events{/privacy}","received_events_url":"https://api.github.com/users/per-samuelsson/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Starcounter/Starcounter/milestones/57","labels_url":"https://api.github.com/repos/Starcounter/Starcounter/milestones/57/labels","id":755148,"number":57,"title":"next","description":"","creator":{"login":"dan31","id":7162535,"avatar_url":"https://avatars.githubusercontent.com/u/7162535?v=3","gravatar_id":"","url":"https://api.github.com/users/dan31","html_url":"https://github.com/dan31","followers_url":"https://api.github.com/users/dan31/followers","following_url":"https://api.github.com/users/dan31/following{/other_user}","gists_url":"https://api.github.com/users/dan31/gists{/gist_id}","starred_url":"https://api.github.com/users/dan31/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dan31/subscriptions","organizations_url":"https://api.github.com/users/dan31/orgs","repos_url":"https://api.github.com/users/dan31/repos","events_url":"https://api.github.com/users/dan31/events{/privacy}","received_events_url":"https://api.github.com/users/dan31/received_events","type":"User","site_admin":false},"open_issues":20,"closed_issues":24,"state":"open","created_at":"2014-08-15T14:53:42Z","updated_at":"2015-01-22T11:50:00Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-01-21T13:33:56Z","updated_at":"2015-01-22T11:50:00Z","closed_at":"2015-01-22T11:50:00Z","body":"We shall support a way to retreive a dynamic type instance from either a .NET class or a type name. We need to support both ```Entity``` based types, and thoose declared as a custom class.\r\n\r\nHence, with the following model\r\n\r\n```C#\r\npublic class Foo : Entity{}\r\n[Database] public class Bar {\r\n  [Type] public BarModel Model;\r\n}\r\n[Database] public class BarModel {}\r\n```\r\n\r\nit should be possible to retreive type instances of ```Entity```, ```Foo``` and ```Bar``` respectively.\r\n\r\nThe model I propose is based on an overloaded static ```TypeOf``` method.\r\n\r\n```C#\r\nclass Program {\r\n  static void Main() {\r\n    Console.Write(Db.TypeOf<Entity>().Name);\r\n    Console.Write(Db.TypeOf<Foo>().Name);\r\n    Console.Write(Db.TypeOf<Bar, BarModel>().Name);\r\n  }\r\n}\r\n/* Entity, Foo, Bar */\r\n``` "}}