{"action":"closed","issue":{"url":"https://api.github.com/repos/volkanceylan/Serenity/issues/35","labels_url":"https://api.github.com/repos/volkanceylan/Serenity/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/volkanceylan/Serenity/issues/35/comments","events_url":"https://api.github.com/repos/volkanceylan/Serenity/issues/35/events","html_url":"https://github.com/volkanceylan/Serenity/issues/35","id":114280412,"number":35,"title":"Implement Mixins","user":{"login":"volkanceylan","id":752470,"avatar_url":"https://avatars.githubusercontent.com/u/752470?v=3","gravatar_id":"","url":"https://api.github.com/users/volkanceylan","html_url":"https://github.com/volkanceylan","followers_url":"https://api.github.com/users/volkanceylan/followers","following_url":"https://api.github.com/users/volkanceylan/following{/other_user}","gists_url":"https://api.github.com/users/volkanceylan/gists{/gist_id}","starred_url":"https://api.github.com/users/volkanceylan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/volkanceylan/subscriptions","organizations_url":"https://api.github.com/users/volkanceylan/orgs","repos_url":"https://api.github.com/users/volkanceylan/repos","events_url":"https://api.github.com/users/volkanceylan/events{/privacy}","received_events_url":"https://api.github.com/users/volkanceylan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/volkanceylan/Serenity/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-30T14:28:25Z","updated_at":"2015-11-08T16:50:58Z","closed_at":"2015-11-08T16:50:58Z","body":"The way we implement master/detail is not so intuitive.\r\n\r\nWe should provide some kind of Mixin functionality. These mixins should intercept and take role in Save/List/Retrieve handlers at various phases. \r\n\r\nThere exists a similar functionality in SaveRequestBehaviourAttribute but this needs to be attached to a SaveRequestHandler, and can't be reused in a ListRequestHandler.\r\n\r\nIdeally, Mixins should list what kind of attributes they are interested in (the ones that activates them). This way attributes that activates mixins shouldn't have any code in them, to avoid any extra dependencies to row classes they are used with.\r\n\r\n```cs\r\npublic class MasterDetailRelationAttribute : Attribute\r\n{\r\n    // zero code\r\n}\r\n\r\npublic class OrderRow : Row\r\n{\r\n      [MasterDetailRelation]\r\n      public List<OrderDetailRow> DetailList\r\n      {\r\n      }\r\n}\r\n\r\n[ActivateOn(typeof(MasterDetailRelationAttribute))]\r\npublic class DetailMixin : ISaveMixin, IListMixin, IFormMixin...\r\n{\r\n     void ISaveMixin.AfterSave() \r\n     {\r\n          // ...\r\n     }\r\n\r\n     void IListMixin.OnReturn() \r\n     {\r\n          // ...\r\n     }\r\n\r\n}\r\n```\r\n\r\nThis way, DetailMixin doesn't have to be referenced from assembly where OrderRow resides, only MasterDetailRelationAttribute is enough."}}