private void EmployeeListForm_Load(object sender, EventArgs e)
 {
     securedObjectSpace       = objectSpaceProvider.CreateObjectSpace();
     employeeGrid.DataSource  = securedObjectSpace.GetBindingList <Employee>();
     newBarButtonItem.Enabled = security.CanCreate <Employee>();
     protectedContentTextEdit = new RepositoryItemProtectedContentTextEdit();
 }
        private void CreateDetailForm(Employee employee = null)
        {
            EmployeeDetailForm detailForm = new EmployeeDetailForm(employee, security, objectSpaceProvider)
            {
                MdiParent   = MdiParent,
                WindowState = FormWindowState.Maximized
            };

            detailForm.Show();
            detailForm.FormClosing += (s, e) => {
                securedObjectSpace.Refresh();
                employeeGrid.DataSource = securedObjectSpace.GetBindingList <Employee>();
            };
        }
        private BaseEdit GetControl(Type type, string memberName)
        {
            BaseEdit    control    = null;
            ITypeInfo   typeInfo   = securedObjectSpace.TypesInfo.FindTypeInfo(type);
            IMemberInfo memberInfo = typeInfo.FindMember(memberName);

            if (memberInfo != null)
            {
                if (memberInfo.IsAssociation)
                {
                    control = new LookUpEdit();
                    ((LookUpEdit)control).Properties.DataSource    = securedObjectSpace.GetBindingList <Department>();
                    ((LookUpEdit)control).Properties.DisplayMember = nameof(Department.Title);
                    LookUpColumnInfo column = new LookUpColumnInfo(nameof(Department.Title));
                    ((LookUpEdit)control).Properties.Columns.Add(column);
                }
                else
                {
                    control = new TextEdit();
                }
            }
            return(control);
        }