private static EvaluatorContextDescriptor GetEvaluatorContextDescriptor(Type objectType, object targetObject) { var objectSpace = XPObjectSpace.FindObjectSpaceByObject(targetObject); return(objectSpace != null?objectSpace.GetEvaluatorContextDescriptor(objectType) : new EvaluatorContextDescriptorDefault(objectType)); }
public IList <IStateMachine> GetStateMachines() { List <IStateMachine> result = new List <IStateMachine>(); result.Add(new TSDataKeluhan(XPObjectSpace.FindObjectSpaceByObject(this))); return(result); }
public static void ReleaseSequence(ISupportSequenceObject supportSequenceObject) { var typeName = supportSequenceObject.Prefix + supportSequenceObject.GetType().FullName; var objectSpace = (XPObjectSpace)XPObjectSpace.FindObjectSpaceByObject(supportSequenceObject); ReleaseSequence(objectSpace.Session, typeName, supportSequenceObject.Sequence); }
public IList <IStateMachine> GetStateMachines() { List <IStateMachine> result = new List <IStateMachine>(); result.Add(new ClaimTrxsStateMachine(XPObjectSpace.FindObjectSpaceByObject(this))); return(result); }
void OnCurrentObjectChanged(object sender, EventArgs eventArgs) { IObjectSpace objectSpace = XPObjectSpace.FindObjectSpaceByObject(_propertyEditor.CurrentObject); objectSpace.ObjectChanged += ObjectSpaceOnObjectChanged; UpdateEditor(((ISupportEditControl)_propertyEditor).GetControl()); }
public static void SupportCompositeKeyPersistentObjects(this IPersistentAssemblyInfo persistentAssemblyInfo) { var keys = persistentAssemblyInfo.PersistentClassInfos.SelectMany(info => info.OwnMembers) .OfType <IPersistentReferenceMemberInfo>() .Where( memberInfo => memberInfo.ReferenceClassInfo.CodeTemplateInfo.CodeTemplate.TemplateType == TemplateType.Struct); var dictionary = new Dictionary <IPersistentClassInfo, ITemplateInfo>(); var objectSpace = XPObjectSpace.FindObjectSpaceByObject(persistentAssemblyInfo); foreach (var key in keys) { if (!dictionary.ContainsKey(key.Owner)) { var info = objectSpace.Create <ITemplateInfo>(); info.Name = SupportPersistentObjectsAsAPartOfACompositeKey; key.Owner.TemplateInfos.Add(info); dictionary.Add(key.Owner, info); } ITemplateInfo templateInfo = dictionary[key.Owner]; templateInfo.TemplateCode = @"protected override void OnLoaded() { base.OnLoaded(); " + GetCode(key) + @" }"; } }
public IList <IStateMachine> GetStateMachines() { List <IStateMachine> result = new List <IStateMachine>(); result.Add(new WorkflowCaseStatusStateMachine(XPObjectSpace.FindObjectSpaceByObject(this))); return(result); }
public ClassAtrributeGenerator(ClassGeneratorInfo classGeneratorInfo, string navigationPath) { _persistentClassInfo = classGeneratorInfo.PersistentClassInfo; _dbTable = classGeneratorInfo.DbTable; _navigationPath = navigationPath; _objectSpace = XPObjectSpace.FindObjectSpaceByObject(_persistentClassInfo); }
public override void Update() { if (Session.FindObject <PersistentAssemblyInfo>(info => info.Name == DynamicAssemblyCalculatedField.AttributeRegistrator.MasterDetailDynamicAssembly) == null) { IPersistentAssemblyInfo persistentAssemblyInfo = new DynamicAssemblyBuilder(Session).Build(DynamicAssemblyCalculatedField.AttributeRegistrator.DMDCustomer, DMDOrder, DMDOrderLine, DynamicAssemblyCalculatedField.AttributeRegistrator.MasterDetailDynamicAssembly); IPersistentClassInfo persistentClassInfo = persistentAssemblyInfo.PersistentClassInfos.Single(info => info.Name == DynamicAssemblyCalculatedField.AttributeRegistrator.DMDCustomer); var persistentCoreTypeMemberInfo = new PersistentCoreTypeMemberInfo(persistentClassInfo.Session); persistentCoreTypeMemberInfo.TypeAttributes.Add(new PersistentVisibleInDetailViewAttribute(persistentCoreTypeMemberInfo.Session)); persistentCoreTypeMemberInfo.TypeAttributes.Add(new PersistentVisibleInListViewAttribute(persistentCoreTypeMemberInfo.Session)); persistentCoreTypeMemberInfo.TypeAttributes.Add(new PersistentVisibleInLookupListViewAttribute(persistentCoreTypeMemberInfo.Session)); persistentCoreTypeMemberInfo.TypeAttributes.Add(new PersistentPersistentAliasAttribute(persistentCoreTypeMemberInfo.Session) { AliasExpression = "DMDOrders.Min(OrderDate)" }); persistentCoreTypeMemberInfo.Name = "FirstOrderDate"; persistentCoreTypeMemberInfo.DataType = DBColumnType.DateTime; var codeTemplateInfo = new CodeTemplateInfo(persistentCoreTypeMemberInfo.Session); var codeTemplate = new CodeTemplate(codeTemplateInfo.Session) { TemplateType = TemplateType.XPCalculatedPropertyMember }; codeTemplate.SetDefaults(); codeTemplate.Name = "CalculatedProperty"; codeTemplateInfo.TemplateInfo = codeTemplate; persistentCoreTypeMemberInfo.CodeTemplateInfo = codeTemplateInfo; persistentClassInfo.OwnMembers.Add(persistentCoreTypeMemberInfo); XPObjectSpace.FindObjectSpaceByObject(persistentClassInfo).CommitChanges(); } }
public MemberAttributeGenerator(MemberGeneratorInfo memberGeneratorInfo, ClassGeneratorInfo classGeneratorInfo) { _objectSpace = XPObjectSpace.FindObjectSpaceByObject(memberGeneratorInfo.PersistentMemberInfo); _persistentMemberInfo = memberGeneratorInfo.PersistentMemberInfo; _column = memberGeneratorInfo.DbColumn; _isPrimaryKey = CalculatePrimaryKey(memberGeneratorInfo, classGeneratorInfo); _dbTable = classGeneratorInfo.DbTable; }
public override void AfterConstruction() { base.AfterConstruction(); IObjectSpace os = XPObjectSpace.FindObjectSpaceByObject(this); Doctor = os.GetObject(SecuritySystem.CurrentUser as Doctor); }
public static void CreateAssociation(this IPersistentMemberInfo persistentMemberInfo, string associationName) { var objectSpace = XPObjectSpace.FindObjectSpaceByObject(persistentMemberInfo); var attribute = objectSpace.CreateWCObject <IPersistentAssociationAttribute>(); attribute.AssociationName = associationName; persistentMemberInfo.TypeAttributes.Add(attribute); }
public static SecuritySystemTypePermissionObject CreateTypePermission(this SecuritySystemRoleBase systemRole, Type targetType) { var objectSpace = XPObjectSpace.FindObjectSpaceByObject(systemRole); var permissionObject = objectSpace.CreateObject <SecuritySystemTypePermissionObject>(); permissionObject.TargetType = targetType; systemRole.TypePermissions.Add(permissionObject); return(permissionObject); }
public static ValidationState StateOf(this RuleSet ruleSet, object targetObject, Func <RuleSetValidationResultItem, bool> filter) { var objectSpace = XPObjectSpace.FindObjectSpaceByObject(targetObject); var ruleSetValidationResult = Validator.RuleSet.ValidateTarget(objectSpace, targetObject, ContextIdentifier.Save); var validationResultItem = ruleSetValidationResult.Results.First(filter); return(validationResultItem.State); }
public override void AfterConstruction() { base.AfterConstruction(); IsActive = true; if (ObjectSpace == null) { ObjectSpace = XPObjectSpace.FindObjectSpaceByObject(this); } }
public AssemblyGenerator(LogonObject logonObject, IPersistentAssemblyInfo persistentAssemblyInfo, string[] tables) { _persistentAssemblyInfo = persistentAssemblyInfo; var dataStoreSchemaExplorer = ((IDataStoreSchemaExplorer)XpoDefault.GetConnectionProvider(logonObject.ConnectionString, AutoCreateOption.None)); dataStoreSchemaExplorer = GetDataStoreSchemaExplorer(dataStoreSchemaExplorer); _storageTables = dataStoreSchemaExplorer.GetStorageTables(tables).Where(table => table.PrimaryKey != null).ToArray(); _logonObject = logonObject; _objectSpace = XPObjectSpace.FindObjectSpaceByObject(persistentAssemblyInfo); }
private static bool CanApply(IModelDashboardDataSource modelDashboardDataSource, FilterEnabled filterEnabled, IDashboardDefinition template) { if (modelDashboardDataSource.NodeEnabled && new[] { FilterEnabled.Always, filterEnabled }.Contains(modelDashboardDataSource.Enabled)) { var objectSpace = XPObjectSpace.FindObjectSpaceByObject(template); var isObjectFitForCriteria = objectSpace.IsObjectFitForCriteria(template, CriteriaOperator.Parse(modelDashboardDataSource.DashboardDefinitionCriteria)); return(isObjectFitForCriteria.HasValue && isObjectFitForCriteria.Value); } return(false); }
public override void AfterConstruction() { base.AfterConstruction(); IObjectSpace objectSpace = XPObjectSpace.FindObjectSpaceByObject(this); if (objectSpace != null) { CreatedBy = (SecuritySystemUser)objectSpace.GetObject(SecuritySystem.CurrentUser); } }
public static IPersistentMemberInfo CreateCollection(this IPersistentClassInfo classInfo, string assemblyName, string classInfoName) { var collectionMemberInfo = XPObjectSpace.FindObjectSpaceByObject(classInfo).CreateWCObject <IPersistentCollectionMemberInfo>(); collectionMemberInfo.Owner = classInfo; collectionMemberInfo.Name = classInfoName + "s"; collectionMemberInfo.SetCollectionTypeFullName(assemblyName + "." + classInfoName); collectionMemberInfo.Init(WCTypesInfo.Instance.FindBussinessObjectType <ICodeTemplate>()); collectionMemberInfo.CodeTemplateInfo.CloneProperties(); classInfo.OwnMembers.Add(collectionMemberInfo); return(collectionMemberInfo); }
public static void SetDefaultTemplate(this IPersistentTemplatedTypeInfo persistentMemberInfo, TemplateType templateType) { var objectSpace = XPObjectSpace.FindObjectSpaceByObject(persistentMemberInfo); persistentMemberInfo.CodeTemplateInfo = objectSpace.CreateWCObject <ICodeTemplateInfo>(); ICodeTemplate defaultTemplate = CodeTemplateBuilder.CreateDefaultTemplate(templateType, persistentMemberInfo.Session, WCTypesInfo.Instance.FindBussinessObjectType <ICodeTemplate>(), GetProvider(persistentMemberInfo)); persistentMemberInfo.CodeTemplateInfo.CodeTemplate = defaultTemplate; persistentMemberInfo.CodeTemplateInfo.CloneProperties(); }
static bool Fit(object targetObject, string criteria) { Type objectType = targetObject.GetType(); var wrapper = new LocalizedCriteriaWrapper(objectType, criteria); wrapper.UpdateParametersValues(targetObject); var objectSpace = XPObjectSpace.FindObjectSpaceByObject(targetObject); EvaluatorContextDescriptor descriptor = objectSpace != null?objectSpace.GetEvaluatorContextDescriptor(objectType) : new EvaluatorContextDescriptorDefault(objectType); var evaluator = new ExpressionEvaluator(descriptor, wrapper.CriteriaOperator, XpandModuleBase.Dictiorary.CustomFunctionOperators); return(evaluator.Fit(targetObject)); }
public static SecuritySystemMemberPermissionsObject CreateMemberPermission(this SecuritySystemTypePermissionObject securitySystemTypePermissionObject, Action <SecuritySystemMemberPermissionsObject> action, bool defaultAllowValues = true) { IObjectSpace objectSpace = XPObjectSpace.FindObjectSpaceByObject(securitySystemTypePermissionObject); var permission = objectSpace.CreateObject <SecuritySystemMemberPermissionsObject>(); permission.AllowRead = defaultAllowValues; permission.AllowWrite = defaultAllowValues; permission.EffectiveRead = defaultAllowValues; permission.EffectiveWrite = defaultAllowValues; securitySystemTypePermissionObject.MemberPermissions.Add(permission); action.Invoke(permission); return(permission); }
public static void Init(this IPersistentTemplatedTypeInfo persistentTemplatedTypeInfo, Type codeTemplateType) { persistentTemplatedTypeInfo.CodeTemplateInfo = XPObjectSpace.FindObjectSpaceByObject(persistentTemplatedTypeInfo).CreateWCObject <ICodeTemplateInfo>(); if (persistentTemplatedTypeInfo is IPersistentMemberInfo) { var persistentMemberInfo = ((IPersistentMemberInfo)persistentTemplatedTypeInfo); persistentMemberInfo.Init(codeTemplateType, persistentMemberInfo.Owner.PersistentAssemblyInfo.CodeDomProvider); } else if (persistentTemplatedTypeInfo is IPersistentClassInfo) { var persistentClassInfo = ((IPersistentClassInfo)persistentTemplatedTypeInfo); persistentClassInfo.Init(codeTemplateType, persistentClassInfo.PersistentAssemblyInfo.CodeDomProvider); } }
private void DashboardDesigner1_DashboardSaving(object sender, DashboardSavingEventArgs e) { e.Handled = true; using (var ms = new MemoryStream()) { e.Dashboard.SaveToXml(ms); ms.Position = 0; using (var sr = new StreamReader(ms, Encoding.UTF8)) { var xml = sr.ReadToEnd(); Xml = xml; XPObjectSpace.FindObjectSpaceByObject(this)?.CommitChanges(); } } }
void MapMemberValues(object previousObject, object currentObject) { var memberInfos = CommonMemberViewItems().Cast <IModelMemberViewItem>().Select(item => item.ModelMember.MemberInfo); foreach (var member in memberInfos) { var value = member.GetValue(previousObject); if (member.MemberTypeInfo.IsPersistent) { value = XPObjectSpace.FindObjectSpaceByObject(currentObject).GetObject(value); } member.SetValue(currentObject, value); } }
public static void ReleaseSequence(ISupportSequenceObject supportSequenceObject) { if (_defaultDataLayer == null) { return; } var objectSpace = (XPObjectSpace)XPObjectSpace.FindObjectSpaceByObject(supportSequenceObject); var sequenceObject = objectSpace.GetObjectByKey(_sequenceObjectType, supportSequenceObject.Prefix + supportSequenceObject.ClassInfo.FullName) as ISequenceObject; if (sequenceObject != null) { var objectFromInterface = objectSpace.CreateObjectFromInterface <ISequenceReleasedObject>(); objectFromInterface.Sequence = supportSequenceObject.Sequence; objectFromInterface.SequenceObject = sequenceObject; } }
private static EvaluatorContextDescriptor GetEvaluatorContextDescriptor(Type objectType, object targetObject) { var objectSpace = XPObjectSpace.FindObjectSpaceByObject(targetObject); if (objectSpace == null) { var iTypeInfo = targetObject.GetITypeInfo(); if (iTypeInfo.IsDomainComponent) { var classInfo = iTypeInfo.QueryXPClassInfo(); return(classInfo.GetEvaluatorContextDescriptor()); } } return(objectSpace != null?objectSpace.GetEvaluatorContextDescriptor(objectType) : new EvaluatorContextDescriptorDefault(objectType)); }
public static SecuritySystemObjectPermissionsObject AddNewObjectPermission(this SecuritySystemTypePermissionObject securitySystemTypePermissionObject, Action <SecuritySystemObjectPermissionsObject> action, bool defaultAllowValues = true) { var objectSpace = XPObjectSpace.FindObjectSpaceByObject(securitySystemTypePermissionObject); var permission = objectSpace.CreateObject <SecuritySystemObjectPermissionsObject>(); permission.AllowDelete = defaultAllowValues; permission.AllowNavigate = defaultAllowValues; permission.AllowRead = defaultAllowValues; permission.AllowWrite = defaultAllowValues; permission.EffectiveDelete = defaultAllowValues; permission.EffectiveNavigate = defaultAllowValues; permission.EffectiveRead = defaultAllowValues; permission.EffectiveWrite = defaultAllowValues; securitySystemTypePermissionObject.ObjectPermissions.Add(permission); action?.Invoke(permission); return(permission); }
public static bool Fit(this CriteriaOperator criteriaOperator, object targetObject) { if (ReferenceEquals(criteriaOperator, null)) { return(true); } Type objectType = targetObject.GetType(); var wrapper = new LocalizedCriteriaWrapper(objectType, criteriaOperator); wrapper.UpdateParametersValues(targetObject); var objectSpace = XPObjectSpace.FindObjectSpaceByObject(targetObject); EvaluatorContextDescriptor descriptor = objectSpace != null?objectSpace.GetEvaluatorContextDescriptor(objectType) : new EvaluatorContextDescriptorDefault(objectType); var evaluator = new ExpressionEvaluator(descriptor, wrapper.CriteriaOperator, XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary.CustomFunctionOperators); return(evaluator.Fit(targetObject)); }
public static void CloneProperties(this ICodeTemplateInfo codeTemplateInfo) { var templateInfo = codeTemplateInfo.TemplateInfo ?? XPObjectSpace.FindObjectSpaceByObject(codeTemplateInfo).CreateWCObject <ITemplateInfo>(); codeTemplateInfo.TemplateInfo = templateInfo; var type = templateInfo.GetType(); var infos = typeof(ITemplateInfo).GetProperties().Select(propertyInfo => new { Value = propertyInfo.GetValue(codeTemplateInfo.CodeTemplate, null), TypeInfoPropertyInfo = type.GetProperty(propertyInfo.Name) }); foreach (var info in infos) { info.TypeInfoPropertyInfo.SetValue(templateInfo, info.Value, null); } }