Exemplo n.º 1
0
 private void CreateButtons()
 {
     if (IsSelector)
     {
         DataSelector.Buttons.Buttons.Clear();
         if (PropertyValue == null)
         {
             if (ObjectSpace.CanInstantiate(MemberInfo.MemberType) && SecuritySystem.IsGranted(new ClientPermissionRequest(MemberInfo.MemberType, null, null, SecurityOperations.Create)))
             {
                 DataSelector.Buttons.AddButton("<span class='glyphicon glyphicon-plus text-info'></span>").OnExecution += XafBootstrapDropdownEdit_AddNew;
             }
         }
         else
         {
             DataSelector.Buttons.AddButton("<span class='glyphicon glyphicon-trash text-danger'></span>").OnExecution += XafBootstrapDropdownEdit_Remove;
         }
     }
     else
     {
         DropDown.Buttons.Buttons.Clear();
         if (PropertyValue == null)
         {
             if (ObjectSpace.CanInstantiate(MemberInfo.MemberType) && SecuritySystem.IsGranted(new ClientPermissionRequest(MemberInfo.MemberType, null, null, SecurityOperations.Create)))
             {
                 DropDown.Buttons.AddButton("<span class='glyphicon glyphicon-plus text-info'></span>").OnExecution += XafBootstrapDropdownEdit_AddNew;
             }
         }
         else
         {
             DropDown.Buttons.AddButton("<span class='glyphicon glyphicon-trash text-danger'></span>").OnExecution += XafBootstrapDropdownEdit_Remove;
         }
     }
 }
Exemplo n.º 2
0
 public void CreateDemoObjects()
 {
     if (ObjectSpace.CanInstantiate(typeof(Project)))
     {
         if (!ObjectSpace.CanInstantiate(typeof(Technology)))
         {
             var typesInfo = ObjectSpace.TypesInfo;
             var npos      = new NonPersistentObjectSpace(typesInfo, ((DevExpress.ExpressApp.DC.TypesInfo)typesInfo).FindEntityStore(typeof(DevExpress.ExpressApp.DC.NonPersistentTypeInfoSource)));
             ((CompositeObjectSpace)ObjectSpace).AdditionalObjectSpaces.Add(npos);
             ((CompositeObjectSpace)ObjectSpace).AutoCommitAdditionalObjectSpaces = true;
             new NPTechnologyAdapter(npos);
         }
         CreateProjects();
         CreateProducts();
         CreateEpochs();
         CreateDepartments();
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Ensures the singletons.
        /// </summary>
        /// <param name="objectSpace">The object space.</param>
        /// <exception cref="ArgumentNullException">objectSpace</exception>
        /// <autogeneratedoc />
        public static void EnsureSingletons(this IObjectSpace objectSpace)
        {
            _ = objectSpace ?? throw new ArgumentNullException(nameof(objectSpace));

            foreach (var typeinfo in objectSpace.TypesInfo.PersistentTypes.Where(p => p.IsAttributeDefined <SingletonAttribute>(false)))
            {
                if (objectSpace.CanInstantiate(typeinfo.Type))
                {
                    var singletonObject = objectSpace.GetSingleton(typeinfo.Type);
                }
            }
        }