예제 #1
0
 private static void MakeInternal(IZetboxContext ctx, ImportedFile obj, File doc)
 {
     // Clone blob, so it could be deleted
     doc.Blob = ctx.Find<Blob>(ctx.CreateBlob(ctx.GetFileInfo(obj.Blob.ID), obj.Blob.MimeType));
     doc.Name = obj.Name;
     ctx.Delete(obj);
 }
 public ImportedFileNavigationSearchScreenViewModel(IViewModelDependencies appCtx, Func<IZetboxContext> ctxFactory,
     IZetboxContext dataCtx, ViewModel parent, NavigationScreen screen)
     : base(appCtx, dataCtx, ctxFactory, parent, screen)
 {
     _ctxFactory = ctxFactory;
     base.Type = typeof(ImportedFile).GetObjectClass(FrozenContext);
 }
예제 #3
0
        public Template(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, DataType dataType)
            : base(_host)
        {
			this.ctx = ctx;
			this.dataType = dataType;

        }
예제 #4
0
        public TypeBase(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, DataType DataType)
            : base(_host)
        {
			this.ctx = ctx;
			this.DataType = DataType;

        }
예제 #5
0
        public ClassesHbm(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, string extraSuffix)
            : base(_host)
        {
			this.ctx = ctx;
			this.extraSuffix = extraSuffix;

        }
        public ObjectReferencePropertyTemplate(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Serialization.SerializationMembersList serializationList, string moduleNamespace, string ownInterface, string name, string implName, string eventName, string fkBackingName, string fkGuidBackingName, string referencedInterface, string referencedImplementation, string associationName, string targetRoleName, string positionPropertyName, string inverseNavigatorName, bool inverseNavigatorIsList, bool eagerLoading, bool relDataTypeExportable, bool callGetterSetterEvents, bool isCalculated, bool disableExport)
            : base(_host)
        {
			this.ctx = ctx;
			this.serializationList = serializationList;
			this.moduleNamespace = moduleNamespace;
			this.ownInterface = ownInterface;
			this.name = name;
			this.implName = implName;
			this.eventName = eventName;
			this.fkBackingName = fkBackingName;
			this.fkGuidBackingName = fkGuidBackingName;
			this.referencedInterface = referencedInterface;
			this.referencedImplementation = referencedImplementation;
			this.associationName = associationName;
			this.targetRoleName = targetRoleName;
			this.positionPropertyName = positionPropertyName;
			this.inverseNavigatorName = inverseNavigatorName;
			this.inverseNavigatorIsList = inverseNavigatorIsList;
			this.eagerLoading = eagerLoading;
			this.relDataTypeExportable = relDataTypeExportable;
			this.callGetterSetterEvents = callGetterSetterEvents;
			this.isCalculated = isCalculated;
			this.disableExport = disableExport;

        }
 public static void Call(IGenerationHost _host, IZetboxContext ctx, IEnumerable<CompoundObjectProperty> properties, string implementationSuffix, string implementationPropertySuffix)
 {
     foreach (var p in properties.Where(p => !p.IsList).OrderBy(p => p.Name))
     {
         Call(_host, ctx, p, implementationSuffix, implementationPropertySuffix);
     }
 }
예제 #8
0
        public static IQueryable<Interface> GetInterfaceList(IZetboxContext ctx)
        {
            if (ctx == null) { throw new ArgumentNullException("ctx"); }

            return from i in ctx.GetQuery<Interface>()
                   select i;
        }
예제 #9
0
        public Registrations(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, string shortName)
            : base(_host)
        {
			this.ctx = ctx;
			this.shortName = shortName;

        }
예제 #10
0
 public DataTypeGraphModel(IViewModelDependencies appCtx, IZetboxContext dataCtx, DiagramViewModel parent,
     DataType obj)
     : base(appCtx, dataCtx, parent, obj)
 {
     this._diagMdl = parent;
     this.DataType = obj;
 }
예제 #11
0
        public static void Call(Arebis.CodeGeneration.IGenerationHost host, IZetboxContext ctx, ObjectClass cls, string ifName, string implName)
        {
            if (host == null) { throw new ArgumentNullException("host"); }

            string propertyDescriptorName = host.Settings["propertydescriptorname"];
            host.CallTemplate("ObjectClasses.CustomTypeDescriptor", ctx, cls, ifName, implName, propertyDescriptorName);
        }
예제 #12
0
        public void InitTestObjects()
        {
            DeleteTestData();
            CreateTestData();

            ctx = GetContext();
        }
        public ModelCsdlEntityTypeFields(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, IEnumerable<Property> properties)
            : base(_host)
        {
			this.ctx = ctx;
			this.properties = properties;

        }
예제 #14
0
        public override void SetUp()
        {
            base.SetUp();

            ctx = GetContext();
            var principalResolver = scope.Resolve<IPrincipalResolver>();

            var currentPrincipal = principalResolver.GetCurrent();

            Assert.That(currentPrincipal, Is.Not.Null, "No current identity found - try syncidentities or setup the current identity correctly");

            identity1 = ctx.Find<Identity>(currentPrincipal.ID);
            identity2 = ctx.GetQuery<Identity>().Where(i => i.ID != identity1.ID).First();

            parent = ctx.Create<SecurityTestParent>();
            parent.Name = "MyParent";

            child1 = ctx.Create<SecurityTestChild>();
            child1.Name = "Child1";
            child1.Identity = identity1;
            child1.Parent = parent;

            child2 = ctx.Create<SecurityTestChild>();
            child2.Name = "Child2";
            child2.Identity = identity2;
            child2.Parent = parent;

            ctx.SubmitChanges();
        }
예제 #15
0
 public SystemTypeViewModel(
     IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent,
     Type type)
     : base(appCtx, dataCtx, parent)
 {
     _type = type;
 }
예제 #16
0
        public DefaultMethods(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, DataType dt)
            : base(_host)
        {
			this.ctx = ctx;
			this.dt = dt;

        }
예제 #17
0
 public ObjectClassViewModel(IViewModelDependencies appCtx,
     IZetboxContext dataCtx, ViewModel parent, ObjectClass cls)
     : base(appCtx, dataCtx, parent, cls)
 {
     _cls = cls;
     cls.PropertyChanged += ModulePropertyChanged;
 }
예제 #18
0
 public MultiplePropertyGroupViewModel(
     IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent,
     string title,
     IEnumerable<ViewModel> obj)
     : base(appCtx, dataCtx, parent, title, obj)
 {
 }
예제 #19
0
        public static object[] MakeArgs(IZetboxContext ctx, ObjectClass cls, NameValueCollection templateSettings)
        {
            if (ctx == null) { throw new ArgumentNullException("ctx"); }
            if (cls == null) { throw new ArgumentNullException("cls"); }
            if (templateSettings == null) { throw new ArgumentNullException("templateSettings"); }

            string extraSuffix = templateSettings["extrasuffix"];
            string interfaceName = cls.Name;
            string implementationName = cls.Name + extraSuffix + Zetbox.API.Helper.ImplementationSuffix;
            string schemaName = cls.Module.SchemaName;
            string tableName = cls.TableName;

            string qualifiedImplementationName = GetAssemblyQualifiedProxy(cls, templateSettings);

            bool isAbstract = cls.IsAbstract;

            List<Property> properties = cls.Properties.ToList();
            List<ObjectClass> subClasses = cls.SubClasses.ToList();

            bool needsRightTable = Templates.ObjectClasses.Template.NeedsRightsTable(cls);
            string qualifiedRightsClassName =
                cls.Module.Namespace + "."
                + Construct.SecurityRulesClassName(cls) + extraSuffix + Zetbox.API.Helper.ImplementationSuffix
                + ", Zetbox.Objects." + extraSuffix + Zetbox.API.Helper.ImplementationSuffix;

            bool needsConcurrency = cls.ImplementsIChangedBy(true);

            return new object[] { interfaceName, implementationName, schemaName, tableName, qualifiedImplementationName, isAbstract, properties, subClasses, needsRightTable, needsConcurrency, qualifiedRightsClassName, cls.GetTableMapping() };
        }
예제 #20
0
        public ReloadReferences(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, DataType cls)
            : base(_host)
        {
			this.ctx = ctx;
			this.cls = cls;

        }
예제 #21
0
 public override void TearDown()
 {
     obj = null;
     ilvm = null;
     ctx = null;
     base.TearDown();
 }
        public AttachToContextTemplate(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, ObjectClass cls)
            : base(_host)
        {
			this.ctx = ctx;
			this.cls = cls;

        }
예제 #23
0
 public ObjectClassViewModel(
     IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent,
     ObjectClass cls)
     : base(appCtx, dataCtx, parent, cls)
 {
     _class = cls;
 }
예제 #24
0
 public void ForgetTestObjects()
 {
     ctx = null;
     oneSide1 = oneSide2 = oneSide3 = null;
     nSide1 = nSide2 = null;
     hasSubmitted = false;
 }
예제 #25
0
 public AssemblyViewModel(
     IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent,
     Assembly obj)
     : base(appCtx, dataCtx, parent, obj)
 {
     _assembly = obj;
 }
예제 #26
0
        public static void Call(IGenerationHost host, IZetboxContext ctx,
            DataType dataType)
        {
            if (host == null) { throw new ArgumentNullException("host"); }
            if (dataType == null) { throw new ArgumentNullException("dataType"); }

            var props = dataType
                .Properties
                .OfType<ObjectReferenceProperty>()
                .OrderBy(p => p.Name)
                .Where(p =>
                {
                    Relation rel = RelationExtensions.Lookup(ctx, p);
                    //RelationEnd relEnd = rel.GetEnd(p);

                    return (rel.Storage == StorageType.MergeIntoA && rel.A.Navigator == p)
                        || (rel.Storage == StorageType.MergeIntoB && rel.B.Navigator == p);
                })
                .Select(p => new UpdateParentTemplateParams()
                {
                    PropertyName = p.Name,
                    IfType = string.Format("{0}.{1}", p.GetReferencedObjectClass().Module.Namespace, p.GetReferencedObjectClass().Name)
                })
                .ToList();

            host.CallTemplate("ObjectClasses.UpdateParentTemplate",
                props);
        }
예제 #27
0
        public RightsClass(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, string className)
            : base(_host)
        {
			this.ctx = ctx;
			this.className = className;

        }
예제 #28
0
        public Template(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Zetbox.App.Base.Module module)
            : base(_host)
        {
			this.ctx = ctx;
			this.module = module;

        }
        public void should_return_all_objects()
        {
            ctx = GetContext();

            var foundGuids = ctx.FindPersistenceObjects<ObjectClass>(guids).ToList().Select(cls => cls.ExportGuid);
            Assert.That(foundGuids, Is.EquivalentTo(guids));
        }
 public override void SetUp()
 {
     base.SetUp();
     ctx = GetContext();
     var objs = ctx.GetQuery<ObjectClass>().Take(10).ToList();
     guids = objs.Select(cls => cls.ExportGuid).ToList();
 }
예제 #31
0
 public ElevatedModeCommand(IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent)
     : base(appCtx, dataCtx, parent, CommonCommandsResources.ElevatedModeCommand_Name, CommonCommandsResources.ElevatedModeCommand_Tooltip)
 {
 }
예제 #32
0
 public override void AttachToContext(IZetboxContext ctx)
 {
     base.AttachToContext(ctx);
 }
예제 #33
0
 public override void AttachToContext(IZetboxContext ctx)
 {
     base.AttachToContext(ctx);
     var nhCtx = (NHibernateContext)ctx;
 }
예제 #34
0
 public RelationEntry(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Relation rel)
     : base(_host, ctx, rel)
 {
 }
예제 #35
0
 public DtoValueViewModel(IViewModelDependencies dependencies, IZetboxContext dataCtx, ViewModel parent, IFileOpener fileOpener, ITempFileService tmpService, object debugInfo)
     : base(dependencies, dataCtx, parent, fileOpener, tmpService, debugInfo)
 {
 }
예제 #36
0
 public OnPropertyChange(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, DataType dt)
     : base(_host, ctx, dt)
 {
 }
예제 #37
0
 public NotifyingValueProperty(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Templates.Serialization.SerializationMembersList serializationList, string type, string name, string modulenamespace, string backingName, bool isCalculated, bool disableExport)
     : base(_host, ctx, serializationList, type, name, modulenamespace, "Proxy." + name, isCalculated, disableExport)
 {
 }
예제 #38
0
        public ReportProblemCommand(IViewModelDependencies appCtx, IProblemReporter reporter, IScreenshotTool screenShot, IZetboxContext dataCtx, ViewModel parent)
            : base(appCtx, dataCtx, parent, CommonCommandsResources.ReportProblemCommand_Name, CommonCommandsResources.ReportProblemCommand_Tooltip)
        {
            if (reporter == null)
            {
                throw new ArgumentNullException("reporter");
            }
            if (screenShot == null)
            {
                throw new ArgumentNullException("screenShot");
            }

            this._reporter   = reporter;
            this._screenShot = screenShot;
        }
예제 #39
0
        public static IList <IPersistenceObject> GetMetaObjects(IZetboxContext ctx, Module module)
        {
            if (ctx == null)
            {
                throw new ArgumentNullException("ctx");
            }
            if (module == null)
            {
                throw new ArgumentNullException("module");
            }
            using (Logging.Exporter.DebugTraceMethodCall("GetMetaObjects", "Module = " + module.Name))
            {
                var result = new List <IPersistenceObject>();
                // break reference for linq
                int moduleID = module.ID;

                AddMetaObjects(result, () => ctx.GetQuery <Module>().Where(i => i.ID == moduleID).ToList().OrderBy(m => m.Name).ThenBy(i => i.ExportGuid));

                AddMetaObjects(result, () => ctx.GetQuery <DataType>().Where(i => i.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.Name).ThenBy(i => i.ExportGuid));

                // export only relation entry ending on a "local" class. Since we do not have proper inter-module dependencies in place, we cannot support pushing interface implementations across modules.
                AddMetaObjects(result, () => ctx.Internals().GetPersistenceObjectQuery <DataType_implements_Interface_RelationEntry>()
                               // Workaround for missing Module relation on DataType_implements_Interface_RelationEntry when creating ZetboxBase.xml
                               .Where(i => i.A != null && i.A.Module != null && i.B != null)
                               .Where(i => i.A.Module == module)
                               .ToList().OrderBy(i => i.A.Name).ThenBy(i => i.B.Name).ThenBy(i => i.A.ExportGuid).ThenBy(i => i.B.ExportGuid));
                AddMetaObjects(result, () => ctx.GetQuery <Property>().Where(i => i.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.ObjectClass.Name).ThenBy(i => i.Name).ThenBy(i => i.ExportGuid));

                AddMetaObjects(result, () => ctx.GetQuery <Relation>().Where(i => i.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.A.Type.Name).ThenBy(i => i.Verb).ThenBy(i => i.B.Type.Name).ThenBy(i => i.ExportGuid));
                // workaround a limitation / mapping error in NHibernate:
                AddMetaObjects(result, () => ctx.GetQuery <Relation>().Where(i => i.Module.ID == moduleID)
                               .ToList()
                               .SelectMany(rel => new RelationEnd[] { rel.A, rel.B })
                               .AsQueryable()
                               //AddMetaObjects(result, ctx.GetQuery<RelationEnd>().Where(i => (i.AParent != null && i.AParent.Module.ID == moduleID) || (i.BParent != null && i.BParent.Module.ID == moduleID))
                               .ToList().OrderBy(i => i.Type.Name).ThenBy(i => i.RoleName).ThenBy(i => i.ExportGuid));
                AddMetaObjects(result, () => ctx.GetQuery <EnumerationEntry>().Where(i => i.Enumeration.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.Enumeration.Name).ThenBy(i => i.Name).ThenBy(i => i.ExportGuid));

                AddMetaObjects(result, () => ctx.GetQuery <Method>().Where(i => i.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.ObjectClass.Name).ThenBy(i => i.Name).ThenBy(i => i.ExportGuid));
                AddMetaObjects(result, () => ctx.GetQuery <BaseParameter>().Where(i => i.Method.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.Method.ObjectClass.Name).ThenBy(i => i.Method.Name).ThenBy(i => i.Name).ThenBy(i => i.ExportGuid));

                // TODO: Add Module to Constraint - or should that not be changable by other modules?
                // All Property Contstraints
                AddMetaObjects(result, () => ctx.GetQuery <Zetbox.App.Base.Constraint>().Where(i => i.ConstrainedProperty.Module.ID == moduleID).ToList().AsQueryable() // local sorting because of GetInterfaceType
                               .ToList().OrderBy(i => i.ConstrainedProperty.ObjectClass.Name).ThenBy(i => i.ConstrainedProperty.Name).ThenBy(i => ctx.GetInterfaceType(i).Type.Name).ThenBy(i => i.ExportGuid));

                // InstanceContstraints and Property Relation entries of UniqueConstraints
                AddMetaObjects(result, () => ctx.GetQuery <InstanceConstraint>().Where(i => i.Constrained.Module.ID == moduleID).ToList().AsQueryable() // local sorting because of GetInterfaceType
                               .ToList().OrderBy(i => i.Constrained.Name).ThenBy(i => ctx.GetInterfaceType(i).Type.Name).ThenBy(i => i.ExportGuid));
                AddMetaObjects(result, () => ctx.Internals().GetPersistenceObjectQuery <IndexConstraint_ensures_unique_on_Property_RelationEntry>().Where(i => i.A.Constrained.Module.ID == moduleID || i.B.Module.ID == moduleID).ToList().AsQueryable()
                               .ToList().OrderBy(i => i.A.ExportGuid).ThenBy(i => i.B.ExportGuid));

                foreach (var invokingConstraint in ctx.GetQuery <InvokingConstraint>().Where(i => i.ConstrainedProperty.Module.ID == moduleID).ToList().AsQueryable() // local sorting because of GetInterfaceType
                         .ToList().OrderBy(i => i.ConstrainedProperty.ObjectClass.Name).ThenBy(i => i.ConstrainedProperty.Name).ThenBy(i => ctx.GetInterfaceType(i).Type.Name).ThenBy(i => i.ExportGuid))
                {
                    result.Add(invokingConstraint.IsValidInvocation);
                    result.Add(invokingConstraint.GetErrorTextInvocation);
                }

                // TODO: Add Module to DefaultPropertyValue - or should that not be changable by other modules?
                AddMetaObjects(result, () => ctx.GetQuery <DefaultPropertyValue>().Where(i => i.Property.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.Property.ObjectClass.Name).ThenBy(i => i.Property.Name).ThenBy(i => i.ExportGuid));

                AddMetaObjects(result, () => ctx.GetQuery <Assembly>().Where(i => i.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.Name).ThenBy(i => i.ExportGuid));
                AddMetaObjects(result, () => ctx.GetQuery <TypeRef>().Where(i => i.Assembly.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.Assembly.Name).ThenBy(i => i.FullName).ThenBy(i => i.ExportGuid));
                AddMetaObjects(result, () => ctx.Internals().GetPersistenceObjectQuery <TypeRef_hasGenericArguments_TypeRef_RelationEntry>().Where(i => i.A.Assembly.Module.ID == moduleID || i.B.Assembly.Module.ID == moduleID)
                               .ToList().AsQueryable() // client side sorting!
                               .ToList().OrderBy(i => i.A.Assembly.Name).ThenBy(i => i.B.Assembly.Name)
                               .ThenBy(i => i.A.FullName).ThenBy(i => i.B.FullName)
                               .ThenBy(i => i.AIndex).ThenBy(i => i.BIndex)
                               .ThenBy(i => i.A.ExportGuid).ThenBy(i => i.B.ExportGuid));

                var icons = ctx.GetQuery <Icon>().Where(i => i.Module.ID == moduleID)
                            .ToList().OrderBy(i => i.IconFile).ThenBy(i => i.ExportGuid).ToList();
                AddMetaObjects(result, () => icons.AsQueryable());
                AddMetaObjects(result, () => icons.Select(i => i.Blob).AsQueryable());
                AddMetaObjects(result, () => ctx.GetQuery <ViewModelDescriptor>().Where(i => i.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.ViewModelRef.Assembly.Name).ThenBy(i => i.ViewModelRef.FullName).ThenBy(i => i.ExportGuid));
                AddMetaObjects(result, () => ctx.GetQuery <ViewDescriptor>().Where(i => i.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.ControlRef.Assembly.Name).ThenBy(i => i.ControlRef.FullName).ThenBy(i => i.ExportGuid));
                AddMetaObjects(result, () => ctx.Internals().GetPersistenceObjectQuery <ViewDescriptor_supports_TypeRef_RelationEntry>().Where(i => i.A.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.A.ControlRef.Assembly.Name).ThenBy(i => i.A.ControlRef.FullName).ThenBy(i => i.A.ExportGuid));

                AddMetaObjects(result, () => ctx.GetQuery <NavigationEntry>()
                               .Where(i => i.Module.ID == moduleID)
                               .ToList()
                               .AsQueryable()
                               .ToList().OrderBy(i => i.Title)
                               .ThenBy(i => i.Parent != null ? i.Parent.Title : String.Empty)
                               .ThenBy(i => i.ExportGuid));
                AddMetaObjects(result, () => ctx.Internals().GetPersistenceObjectQuery <NavigationEntry_accessed_by_Group_RelationEntry>()
                               .Where(i => i.A.Module.ID == moduleID)
                               .ToList()
                               .AsQueryable()
                               .ToList().OrderBy(i => i.A.Title)
                               .ThenBy(i => i.A.Parent != null ? i.A.Parent.Title : String.Empty)
                               .ThenBy(i => i.B.Name)
                               .ThenBy(i => i.A.ExportGuid));

                // Security
                AddMetaObjects(result, () => ctx.GetQuery <Group>().Where(i => i.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.Name).ThenBy(i => i.ExportGuid));
                AddMetaObjects(result, () => ctx.GetQuery <AccessControl>().Where(i => i.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.Name).ThenBy(i => i.ExportGuid));
                AddMetaObjects(result, () => ctx.Internals().GetPersistenceObjectQuery <RoleMembership_resolves_Relation_RelationEntry>().Where(i => i.A.Module.ID == moduleID)
                               .ToList().AsQueryable().ToList().OrderBy(i => i.A.ExportGuid).ThenBy(i => i.B.ExportGuid));

                AddMetaObjects(result, () => ctx.GetQuery <ControlKind>().Where(i => i.Module.ID == moduleID)
                               .ToList().AsQueryable() // TODO: remove this workaround for GetInterfaceType()
                               .ToList().OrderBy(i => ctx.GetInterfaceType(i).Type.FullName)
                               .ThenBy(i => i.ExportGuid));
                AddMetaObjects(result, () => ctx.Internals().GetPersistenceObjectQuery <ViewModelDescriptor_displayedBy_ControlKind_RelationEntry>()
                               .Where(i => i.A.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.A.ViewModelRef.Assembly.Name)
                               .ThenBy(i => i.A.ViewModelRef.FullName)
                               .ThenBy(i => i.A.ExportGuid)
                               .ThenBy(i => i.B.ExportGuid));
                AddMetaObjects(result, () => ctx.GetQuery <FilterConfiguration>().Where(i => i.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.ExportGuid));
                AddMetaObjects(result, () => ctx.GetQuery <Application>().Where(i => i.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.Name)
                               .ThenBy(i => i.ExportGuid));

                // Properties <-> Methods
                AddMetaObjects(result, () => ctx.Internals().GetPersistenceObjectQuery <ObjectReferenceProperty_shows_Method_RelationEntry>()
                               .Where(i => i.A.Module.ID == moduleID || i.B.Module.ID == moduleID)
                               .ToList()
                               .OrderBy(i => i.A.Name)
                               .ThenBy(i => i.A.ExportGuid)
                               .ThenBy(i => i.B.ExportGuid));

                // Sequences
                AddMetaObjects(result, () => ctx.GetQuery <Sequence>().Where(i => i.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.Description).ThenBy(i => i.ExportGuid));

                // ServiceDescriptors
                AddMetaObjects(result, () => ctx.GetQuery <ServiceDescriptor>().Where(i => i.Module.ID == moduleID)
                               .ToList().OrderBy(i => i.Description).ThenBy(i => i.ExportGuid));

                return(result);
            }
        }
예제 #40
0
 public SimpleItemCommandViewModel(IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent, string label, string tooltip, Action <IEnumerable <T> > execute)
     : base(appCtx, dataCtx, parent, label, tooltip)
 {
     this.execute = execute;
 }
예제 #41
0
 public ControlKindViewModel(IViewModelDependencies dependencies, IZetboxContext dataCtx, ViewModel parent, ControlKind obj)
     : base(dependencies, dataCtx, parent, obj)
 {
     Kind = obj;
 }
예제 #42
0
 public TaskViewModel(IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent, Task obj)
     : base(appCtx, dataCtx, parent, obj)
 {
 }
예제 #43
0
 public EagerLoadingSerialization(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, SerializerDirection direction, string streamName, string xmlnamespace, string xmlname, string collectionName, bool serializeIds, bool serializeRelationEntries)
     : base(_host)
 {
     this.ctx                      = ctx;
     this.direction                = direction;
     this.streamName               = streamName;
     this.xmlnamespace             = xmlnamespace;
     this.xmlname                  = xmlname;
     this.collectionName           = collectionName;
     this.serializeIds             = serializeIds;
     this.serializeRelationEntries = serializeRelationEntries;
 }
예제 #44
0
 public CollectionEntryTemplate(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx)
     : base(_host)
 {
     this.ctx = ctx;
 }
예제 #45
0
 public IdProperty(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx)
     : base(_host, ctx)
 {
 }
예제 #46
0
 public RefreshCommand(IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent, IRefreshCommandListener listener)
     : base(appCtx, dataCtx, parent, CommonCommandsResources.RefreshCommand_Name, CommonCommandsResources.RefreshCommand_Tooltip)
 {
     this.Listener = listener;
 }
예제 #47
0
        private void CreateTestData()
        {
            {
                srvCtx = scope.Resolve <IZetboxServerContext>();

                var grpAdmin    = Zetbox.NamedObjects.Base.Groups.Administrator.Find(srvCtx);
                var grpEveryOne = Zetbox.NamedObjects.Base.Groups.Everyone.Find(srvCtx);

                // Create Identities
                admin             = srvCtx.Create <Identity>();
                admin.DisplayName = "Administrator";
                admin.UserName    = "******";
                admin.Groups.Add(grpAdmin);
                admin.Groups.Add(grpEveryOne);

                identity1             = srvCtx.Create <Identity>();
                identity1.DisplayName = "User 1";
                identity1.UserName    = "******";
                identity1.Groups.Add(grpEveryOne);

                identity2             = srvCtx.Create <Identity>();
                identity2.DisplayName = "User 2";
                identity2.UserName    = "******";
                identity2.Groups.Add(grpEveryOne);

                identity3_low             = srvCtx.Create <Identity>();
                identity3_low.DisplayName = "User 3 with low privileges";
                identity3_low.UserName    = "******";

                ma1          = srvCtx.Create <Mitarbeiter>();
                ma1.Name     = identity1.DisplayName;
                ma1.Identity = identity1;

                ma2          = srvCtx.Create <Mitarbeiter>();
                ma2.Name     = identity2.DisplayName;
                ma2.Identity = identity2;

                ma3_low          = srvCtx.Create <Mitarbeiter>();
                ma3_low.Name     = identity3_low.DisplayName;
                ma3_low.Identity = identity3_low;

                srvCtx.SubmitChanges();
            }


            {
                // Create 3 identity context
                var ctx = scope.Resolve <ServerZetboxContextFactory>().Invoke(identity1);

                // Create TestData with Identity 1
                prj1      = ctx.Create <Projekt>();
                prj1.Name = "Project User 1";
                prj1.Mitarbeiter.Add(ctx.Find <Mitarbeiter>(ma1.ID));
                CreateTasks(ctx, prj1);

                // Create TestData with Identity 1, common
                prjCommon      = ctx.Create <Projekt>();
                prjCommon.Name = "Project Common";
                prjCommon.Mitarbeiter.Add(ctx.Find <Mitarbeiter>(ma1.ID));
                prjCommon.Mitarbeiter.Add(ctx.Find <Mitarbeiter>(ma2.ID));
                CreateTasks(ctx, prjCommon);

                ctx.SubmitChanges();

                prj1ID      = prj1.ID;
                prjCommonID = prjCommon.ID;
            }

            {
                var ctx = scope.Resolve <ServerZetboxContextFactory>().Invoke(identity2);

                // Create TestData with Identity 2
                prj2      = ctx.Create <Projekt>();
                prj2.Name = "Project User 2";
                prj2.Mitarbeiter.Add(ctx.Find <Mitarbeiter>(ma2.ID));
                CreateTasks(ctx, prj2);
                ctx.SubmitChanges();

                prj2ID = prj2.ID;
            }

            id1Ctx     = scope.Resolve <ServerZetboxContextFactory>().Invoke(identity1);
            id2Ctx     = scope.Resolve <ServerZetboxContextFactory>().Invoke(identity2);
            id3Ctx_low = scope.Resolve <ServerZetboxContextFactory>().Invoke(identity3_low);

            prj1      = id1Ctx.Find <Projekt>(prj1ID);
            prjCommon = id1Ctx.Find <Projekt>(prjCommonID);
            prj2      = id2Ctx.Find <Projekt>(prj2ID);


            // Fix security tables
            // Own test checks if this works during object modifications too
            var connectionString = config.Server.GetConnectionString(Helper.ZetboxConnectionStringKey);

            using (var db = scope.ResolveNamed <ISchemaProvider>(connectionString.SchemaProvider))
            {
                db.Open(connectionString.ConnectionString);
                db.ExecRefreshRightsOnProcedure(db.GetProcedureName("projekte", "RefreshRightsOn_Projekte"));
                db.ExecRefreshRightsOnProcedure(db.GetProcedureName("projekte", "RefreshRightsOn_Tasks"));
                db.ExecRefreshRightsOnProcedure(db.GetProcedureName("projekte", "RefreshRightsOn_Auftraege"));
            }
        }
예제 #48
0
 public ReloadReferences(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, DataType cls)
     : base(_host)
 {
     this.ctx = ctx;
     this.cls = cls;
 }
예제 #49
0
 public QuoteViewModel(IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent, Quote obj)
     : base(appCtx, dataCtx, parent, obj)
 {
     this.Quote = obj;
 }
예제 #50
0
 public SingleValueFilterViewModel(IViewModelDependencies dependencies, IZetboxContext dataCtx, ViewModel parent, IUIFilterModel mdl)
     : base(dependencies, dataCtx, parent, mdl)
 {
 }
예제 #51
0
        public object InvokeServerMethod(IZetboxContext ctx, InterfaceType ifType, int ID, string method, Type retValType, IEnumerable <Type> parameterTypes, IEnumerable <object> parameter, IEnumerable <IPersistenceObject> objects, IEnumerable <ObjectNotificationRequest> notificationRequests, out IEnumerable <IPersistenceObject> changedObjects, out List <IStreamable> auxObjects)
        {
            _perfCounter.IncrementServerMethodInvocation();

            object result = null;

            auxObjects = null;

            byte[] retChangedObjectsArray = null;
            byte[] bytes = null;

            using (var parameterStream = new MemoryStream())
                using (var parameterWriter = _writerFactory(new BinaryWriter(parameterStream)))
                {
                    foreach (var paramVal in parameter)
                    {
                        parameterWriter.Write(paramVal);
                    }

                    using (var changedObjectsStream = new MemoryStream())
                        using (var sw = _writerFactory(new BinaryWriter(changedObjectsStream)))
                        {
                            SendObjects(objects, sw);

                            var _ifType           = ifType.ToSerializableType();
                            var _parameterTypes   = parameterTypes.Select(t => _iftFactory(t).ToSerializableType()).ToArray();
                            var _parameterStream  = parameterStream.ToArray();
                            var _changedObjStream = changedObjectsStream.ToArray();
                            var _nReq             = notificationRequests.ToArray();

                            MakeRequest(() =>
                            {
                                bytes = _service.InvokeServerMethod(
                                    out retChangedObjectsArray,
                                    ZetboxGeneratedVersionAttribute.Current,
                                    _ifType,
                                    ID,
                                    method,
                                    _parameterTypes,
                                    _parameterStream,
                                    _changedObjStream,
                                    _nReq);
                            });
                        }
                }

            IEnumerable <IPersistenceObject> tmpChangedObjects = null;

            using (var resultStream = new MemoryStream(bytes))
            {
                using (var retChangedObjects = new MemoryStream(retChangedObjectsArray))
                    using (var br = _readerFactory(new BinaryReader(retChangedObjects)))
                    {
                        tmpChangedObjects = ReceiveObjectList(ctx, br).Cast <IPersistenceObject>();
                    }

                resultStream.Seek(0, SeekOrigin.Begin);

                if (retValType.IsIStreamable())
                {
                    var br = _readerFactory(new BinaryReader(resultStream));
                    result = ReceiveObjects(ctx, br, out auxObjects).Cast <IPersistenceObject>().FirstOrDefault();
                }
                else if (retValType.IsIEnumerable() && retValType.FindElementTypes().Any(t => t.IsIPersistenceObject()))
                {
                    var   br  = _readerFactory(new BinaryReader(resultStream));
                    IList lst = (IList)Activator.CreateInstance(typeof(List <>).MakeGenericType(retValType.FindElementTypes().Single(t => t.IsIPersistenceObject())));
                    foreach (object resultObj in ReceiveObjects(ctx, br, out auxObjects))
                    {
                        lst.Add(resultObj);
                    }
                    result = lst;
                }
                else if (resultStream.Length > 0)
                {
                    result = new BinaryFormatter().Deserialize(resultStream);
                }
                else
                {
                    result = null;
                }

                changedObjects = tmpChangedObjects;
                return(result);
            }
        }
예제 #52
0
 public void ForgetTestObjects()
 {
     aSide1 = aSide2 = null;
     bSide1 = bSide2 = null;
     ctx    = null;
 }
예제 #53
0
 public void AttachToContext(IZetboxContext ctx)
 {
     Context = ctx;
 }
예제 #54
0
 public void DetachFromContext(IZetboxContext ctx)
 {
     ctx = null;
 }
예제 #55
0
 public WindowViewModel(IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent)
     : base(appCtx, dataCtx, parent)
 {
 }
예제 #56
0
 public CacheDebuggerViewModel(IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent)
     : base(appCtx, dataCtx, parent)
 {
     Cache.CachesCollectionChanged += new EventHandler(Cache_CachesCollectionChanged);
 }
 public PurchaseInvoiceViewModel(IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent, PurchaseInvoice obj)
     : base(appCtx, dataCtx, parent, obj)
 {
     this.Invoice = obj;
 }
예제 #58
0
 protected ValueListWrapper(IZetboxContext ctx, TParent parent, Action parentNotifier, TEntryCollection collection)
     : base(ctx, parent, parentNotifier, collection)
 {
 }
예제 #59
0
 public ItemCommandViewModel(IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel progressDisplayer, string label, string tooltip)
     : base(appCtx, dataCtx, progressDisplayer, label, tooltip)
 {
 }
예제 #60
0
 /// <inheritdoc/>
 public override IEnumerable <IPersistenceObject> SetObjects(Guid version, IZetboxContext ctx, IEnumerable <IPersistenceObject> objects, IEnumerable <ObjectNotificationRequest> notificationRequests)
 {
     return(base.SetObjects(version, ctx, objects, notificationRequests));
 }