当前位置: 首页>>代码示例>>C#>>正文


C# IObjectSpace.IsNewObject方法代码示例

本文整理汇总了C#中IObjectSpace.IsNewObject方法的典型用法代码示例。如果您正苦于以下问题:C# IObjectSpace.IsNewObject方法的具体用法?C# IObjectSpace.IsNewObject怎么用?C# IObjectSpace.IsNewObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IObjectSpace的用法示例。


在下文中一共展示了IObjectSpace.IsNewObject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Process

        public void Process(XafApplication application,IObjectSpace objectSpace) {
            var user = objectSpace.FindObject(XpandModuleBase.UserType, new GroupOperator(GroupOperatorType.Or,new BinaryOperator("UserName", UserName),new BinaryOperator("Email",Email)),true) as IAuthenticationStandardUser;
            if (user != null&&!objectSpace.IsNewObject(user))
                throw new ArgumentException(CaptionHelper.GetLocalizedText(XpandSecurityModule.XpandSecurity, "AlreadyRegistered"));

            var securityUserWithRoles = objectSpace.IsNewObject(user)? (ISecurityUserWithRoles) user
                                                               : (ISecurityUserWithRoles)objectSpace.CreateObject(XpandModuleBase.UserType);
            User = securityUserWithRoles;
            var userTypeInfo = application.TypesInfo.FindTypeInfo(XpandModuleBase.UserType);
            var modelRegistration = (IModelRegistration)((IModelOptionsRegistration)application.Model.Options).Registration;
            AddRoles(modelRegistration, userTypeInfo, securityUserWithRoles, objectSpace);

            userTypeInfo.FindMember("UserName").SetValue(securityUserWithRoles,UserName);
            userTypeInfo.FindMember("IsActive").SetValue(securityUserWithRoles,modelRegistration.ActivateUser);

            modelRegistration.EmailMember.MemberInfo.SetValue(securityUserWithRoles,Email);
            var activationLinkMember = modelRegistration.ActivationIdMember;
            if (activationLinkMember!=null) {
                activationLinkMember.MemberInfo.SetValue(securityUserWithRoles, Guid.NewGuid().ToString());
            }

            securityUserWithRoles.CallMethod("SetPassword", Password);
            objectSpace.CommitChanges();
        }
开发者ID:noxe,项目名称:eXpand,代码行数:24,代码来源:Parameters.cs

示例2: GetObjectCore

        protected virtual object GetObjectCore(IModelDetailView modelView, object objectKey, IObjectSpace objectSpace) {
            Type type = modelView.ModelClass.TypeInfo.Type;
            object obj;

            if (XafTypesInfo.CastTypeToTypeInfo(type).IsPersistent) {
                if (objectKey != null && !(objectKey is CriteriaOperator))
                    obj = objectSpace.GetObjectByKey(type, objectKey);
                else {
                    obj = objectSpace.FindObject(type, (CriteriaOperator)objectKey) ?? objectSpace.CreateObject(type);
                    if (!(objectSpace.IsNewObject(obj)))
                        ((IXafApplication)_application).AfterViewShown += OnAfterViewShown;
                }
            } else {
                obj = (type.GetConstructor(new[] { typeof(Session) }) != null) ? objectSpace.CreateObject(type) : Activator.CreateInstance(type);
            }
            return obj;
        }
开发者ID:kevin3274,项目名称:eXpand,代码行数:17,代码来源:ViewShortCutProccesor.cs

示例3: OnSaving

        /// <summary>
        /// Обрабатывает генерацию нового регистрационного номера и кода документа в соответствии с нумератором
        /// </summary>
        public static void OnSaving(ISerialDataObject serialDataObject, IObjectSpace os)
        {
            if (os != null ? os.IsNewObject(serialDataObject) : false)
            {
                serialDataObject.RegDate = DateTime.Now;
                serialDataObject.Number = 0;

                GenerateSequence(serialDataObject, os);

                if (serialDataObject.Numerator == null)
                {
                    serialDataObject.Numerator = DBNumerator.GetNumerator(os, XafTypesInfo.Instance.FindTypeInfo(serialDataObject.GetType()), serialDataObject.Department);
                }

                if (String.IsNullOrEmpty(serialDataObject.RegCode))
                {
                    serialDataObject.RegCode = serialDataObject.Numerator != null ? ParseExtension(serialDataObject, serialDataObject.Numerator.ExpressionCodeGeneration) : serialDataObject.Number.ToString();
                }

                if (String.IsNullOrEmpty(serialDataObject.ObjectCode))
                {
                    serialDataObject.ObjectCode = serialDataObject.RegCode;
                }
            }
        }
开发者ID:Rukhlov,项目名称:DataStudio,代码行数:28,代码来源:ISerialDataObject.cs

示例4: SetObject

 /// <summary>
 /// Устанавливает ссылку на объект 
 /// </summary>
 /// <param name="objectSpace">Пространство объектов</param>
 /// <param name="value">Объект, на который устанавливается ссылка</param>
 /// <exception cref="ArgumentException">Попытка установить ссылку на несохраненный объект</exception>
 public void SetObject(IObjectSpace objectSpace, object value)
 {
     if (value == null)
         TargetKeyValue = null;
     else if (objectSpace.IsNewObject(value))
         throw new ArgumentException("Referenced saved object expected");
     else
         TargetKeyValue = objectSpace.GetKeyValue(value);
 }
开发者ID:LSTANCZYK,项目名称:devexpress_xaf_aurum,代码行数:15,代码来源:Reference.cs


注:本文中的IObjectSpace.IsNewObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。