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


C# IObjectSpace.CreateObject方法代码示例

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


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

示例1: InitializeDefaultSolution

 public static void InitializeDefaultSolution(IObjectSpace os)
 {
     var enumerable = ReflectionHelper.FindTypeDescendants(ReflectionHelper.FindTypeInfoByName(typeof(I单据编号).FullName));
     var dictionary = os.GetObjects<单据编号方案>(null, true).ToDictionary(p => p.应用单据);
     foreach (ITypeInfo info2 in enumerable)
     {
         if (!info2.IsAbstract && info2.IsPersistent)
         {
             var key = info2.Type;
             单据编号方案 i单据编号方案 = null;
             if (dictionary.ContainsKey(key))
             {
                 i单据编号方案 = dictionary[key];
             }
             else
             {
                 i单据编号方案 = os.CreateObject<单据编号方案>();
                 i单据编号方案.名称 = key.FullName;
                 i单据编号方案.应用单据 = info2.Type;
                 var item = os.CreateObject<单据编号自动编号规则>();
                 item.格式化字符串 = "00000";
                 i单据编号方案.编号规则.Add(item);
                 dictionary.Add(key, i单据编号方案);
             }
         }
     }
     os.CommitChanges();
 }
开发者ID:ZixiangBoy,项目名称:CIIP,代码行数:28,代码来源:SequenceGeneratorInitializer.cs

示例2: CreateRegistrationEmailTemplates

        private void CreateRegistrationEmailTemplates(IObjectSpace objectSpace) {
            if (!objectSpace.Contains<EmailTemplate>()) {
                var emailTemplate = objectSpace.CreateObject<EmailTemplate>();
                emailTemplate.Configure(EmailTemplateConfig.UserActivation, "http://localhost:50822/");

                emailTemplate = objectSpace.CreateObject<EmailTemplate>();
                emailTemplate.Configure(EmailTemplateConfig.PassForgotten);
            }
        }
开发者ID:aries544,项目名称:eXpand,代码行数:9,代码来源:Updater.cs

示例3: ClassGeneratorHelper

 public ClassGeneratorHelper(IObjectSpace XPObjectSpace) {
     _persistentAssemblyInfo = XPObjectSpace.CreateObject<PersistentAssemblyInfo>();
     _persistentAssemblyInfo.Name = "PersistentAssemblyInfo";
     _persistentClassInfo = XPObjectSpace.CreateObject<PersistentClassInfo>();
     _persistentClassInfo.Name = "MainTable";
     _persistentAssemblyInfo.PersistentClassInfos.Add(_persistentClassInfo);
     _persistentClassInfo.SetDefaultTemplate(TemplateType.Class);
     _classGeneratorInfos = new Dictionary<string, ClassGeneratorInfo>();
     var classGeneratorInfo = new ClassGeneratorInfo(PersistentClassInfo, DbTable);
     _classGeneratorInfos.Add(PersistentClassInfo.Name, classGeneratorInfo);
 }
开发者ID:jdraith1,项目名称:eXpand,代码行数:11,代码来源:MapperContexts.cs

示例4: Authenticate

 public override object Authenticate(IObjectSpace objectSpace)
 {
     string systemUserName = WindowsIdentity.GetCurrent().Name;
     string enteredUserName = ((AuthenticationStandardLogonParameters)LogonParameters).UserName;
     if (string.IsNullOrEmpty(enteredUserName))
     {
         throw new ArgumentException(SecurityExceptionLocalizer.GetExceptionMessage(SecurityExceptionId.UserNameIsEmpty));
     }
     if (!String.Equals(systemUserName, enteredUserName))
     {
         throw new AuthenticationException(enteredUserName, "Invalid user name");
     }
     object user = objectSpace.FindObject(UserType, new BinaryOperator("UserName", systemUserName));
     if (user == null)
     {
         user = objectSpace.CreateObject(UserType);
         ((IAuthenticationActiveDirectoryUser)user).UserName = systemUserName;
         bool strictSecurityStrategyBehavior = SecurityModule.StrictSecurityStrategyBehavior;
         SecurityModule.StrictSecurityStrategyBehavior = false;
         objectSpace.CommitChanges();
         SecurityModule.StrictSecurityStrategyBehavior = strictSecurityStrategyBehavior;
     }
     if (!((IAuthenticationStandardUser)user).ComparePassword(((AuthenticationStandardLogonParameters)LogonParameters).Password))
     {
         throw new AuthenticationException(systemUserName, SecurityExceptionLocalizer.GetExceptionMessage(SecurityExceptionId.RetypeTheInformation));
     }
     return user;
 }
开发者ID:shukla2009,项目名称:Personal,代码行数:28,代码来源:AuthenticateUser.cs

示例5: CreateOutputPackage

        /// <summary>
        /// Creates the output package.
        /// </summary>
        /// <param name="objectSpace">The object space.</param>
        /// <param name="recipient">The recipient.</param>
        /// <param name="packageType">Type of the package.</param>
        /// <returns>Output package</returns>
        public Package CreateOutputPackage(IObjectSpace objectSpace, ReplicationNode recipient, PackageType packageType)
        {
            var result = objectSpace.CreateObject<Package>();

            result.ApplicationName = XafDeltaModule.XafApp.ApplicationName;
            result.SenderNodeId = Owner.CurrentNodeId;
            result.RecipientNodeId = recipient.NodeId;
            result.PackageType = packageType;

            // for broadcast package recipient node Id is "AllNodes"
            if (result.SenderNodeId == result.RecipientNodeId)
                result.RecipientNodeId = ReplicationNode.AllNodes;

            // assign package id
            if (packageType == PackageType.Snapshot)
            {
                recipient.SnapshotDateTime = DateTime.UtcNow;
                recipient.LastSavedSnapshotNumber++;
                result.PackageId = recipient.LastSavedSnapshotNumber;
            }
            else
            {
                recipient.LastSavedPackageNumber++;
                result.PackageId = recipient.LastSavedPackageNumber;
            }

            return result;
        }
开发者ID:xafdelta,项目名称:xafdelta,代码行数:35,代码来源:MessagingService.cs

示例6: AuthenticateActiveDirectory

 private object AuthenticateActiveDirectory(IObjectSpace objectSpace) {
     var windowsIdentity = WindowsIdentity.GetCurrent();
     if (windowsIdentity != null) {
         string userName = windowsIdentity.Name;
         var user = (IAuthenticationActiveDirectoryUser)objectSpace.FindObject(UserType, new BinaryOperator("UserName", userName));
         if (user == null) {
             if (_createUserAutomatically) {
                 var args = new CustomCreateUserEventArgs(objectSpace, userName);
                 if (!args.Handled) {
                     user = (IAuthenticationActiveDirectoryUser)objectSpace.CreateObject(UserType);
                     user.UserName = userName;
                     if (Security != null) {
                         //Security.InitializeNewUser(objectSpace, user);
                         Security.CallMethod("InitializeNewUser", new object[]{objectSpace, user});
                     }
                 }
                 objectSpace.CommitChanges();
             }
         }
         if (user == null) {
             throw new AuthenticationException(userName);
         }
         return user;
     }
     return null;
 }
开发者ID:kamchung322,项目名称:eXpand,代码行数:26,代码来源:AuthenticationCombined.cs

示例7: CreateArtifact

 private static ModuleArtifact CreateArtifact(ModuleChild moduleChild, ModuleArtifactType moduleArtifactType,IObjectSpace objectSpace, Type type){
     var moduleArtifact = objectSpace.CreateObject<ModuleArtifact>();
     moduleArtifact.Name = type.Name;
     moduleArtifact.Type = moduleArtifactType;
     moduleArtifact.ModuleChilds.Add(moduleChild);
     return moduleArtifact;
 }
开发者ID:aries544,项目名称:eXpand,代码行数:7,代码来源:ParsingExtensions.cs

示例8: CreateForPackageSession

 /// <summary>
 /// Creates for package session.
 /// </summary>
 /// <param name="objectSpace">The object space.</param>
 /// <param name="packageSession">The package session.</param>
 /// <returns>New external protocol session</returns>
 public static ExternalProtocolSession CreateForPackageSession(IObjectSpace objectSpace, PackageSession packageSession)
 {
     var result = objectSpace.CreateObject<ExternalProtocolSession>();
     result.SessionId = packageSession.SessionId;
     result.Route = packageSession.Route;
     result.StartedOn = packageSession.StartedOn;
     return result;
 }
开发者ID:xafdelta,项目名称:xafdelta,代码行数:14,代码来源:ExternalProtocolSession.cs

示例9: Generate

 void Generate(IObjectSpace objectSpace, Type typeToSerialize) {
     if (!SerializationConfigurationQuery.ConfigurationExists(((XPObjectSpace)objectSpace).Session, typeToSerialize, _serializationConfigurationGroup)) {
         var serializationConfiguration =
             (ISerializationConfiguration)
             objectSpace.CreateObject(TypesInfo.Instance.SerializationConfigurationType);
         serializationConfiguration.SerializationConfigurationGroup = _serializationConfigurationGroup;
         serializationConfiguration.TypeToSerialize = typeToSerialize;
         Generate(serializationConfiguration);
     }
 }
开发者ID:aries544,项目名称:eXpand,代码行数:10,代码来源:ClassInfoGraphNodeBuilder.cs

示例10: GetInstance

 public static IFirstLaunchParameters GetInstance(IObjectSpace objectSpace)
 {
     var parameters = objectSpace.FindObject<IFirstLaunchParameters>(null);
     if (parameters == null)
     {
         parameters = objectSpace.CreateObject<IFirstLaunchParameters>();
         parameters.DummyObjectsCreated = false;
     }
     return parameters;
 }
开发者ID:Rukhlov,项目名称:DataStudio,代码行数:10,代码来源:IFirstLaunchParameters.cs

示例11: CreateModelNodeAttributes

 private static IEnumerable<ModelNodeAttribute> CreateModelNodeAttributes(IObjectSpace objectSpace,Type interfaceExtender) {
     foreach (var propertyInfo in interfaceExtender.Properties()) {
         var modelNodeAttribute = objectSpace.CreateObject<ModelNodeAttribute>();
         modelNodeAttribute.Name = propertyInfo.Name;
         var descriptionAttribute = propertyInfo.GetCustomAttributes(true).OfType<DescriptionAttribute>().FirstOrDefault();
         if (descriptionAttribute != null)
             modelNodeAttribute.Text = descriptionAttribute.Description;
         yield return modelNodeAttribute;
     }
 }
开发者ID:aries544,项目名称:eXpand,代码行数:10,代码来源:ParsingExtensions.cs

示例12: CreateForArgs

 /// <summary>
 /// Creates for argumets.
 /// </summary>
 /// <param name="objectSpace">The object space.</param>
 /// <param name="args">The arguments.</param>
 /// <returns></returns>
 public static MethodCallParams CreateForArgs(IObjectSpace objectSpace, object[] args)
 {
     var i = 0;
     var result = objectSpace.CreateObject<MethodCallParams>();
     foreach (var arg in args)
     {
         var paramValue = MethodParamValue.CreateForArg(objectSpace, arg);
         paramValue.OrdNo = i++;
         paramValue.MethodCallParams = result;
     }
     return result;
 }
开发者ID:xafdelta,项目名称:xafdelta,代码行数:18,代码来源:MethodCallParams.cs

示例13: CompoundPKMemberGeneratorHelper

 public CompoundPKMemberGeneratorHelper(IObjectSpace XPObjectSpace)
     : base(XPObjectSpace) {
     _dbColumn1 = new DBColumn { Name = "DBColumn1", ColumnType = DBColumnType.Int32 };
     _dbColumn2 = new DBColumn { Name = "DBColumn2", ColumnType = DBColumnType.Int32 };
     var dbColumns = new[] { _dbColumn1, _dbColumn2 };
     DbTable.Columns.AddRange(dbColumns);
     DbTable.PrimaryKey = new DBPrimaryKey(dbColumns);
     _structPersistentClassInfo = XPObjectSpace.CreateObject<PersistentClassInfo>();
     _structPersistentClassInfo.Name = "MainTable" + TableMapper.KeyStruct;
     _structPersistentClassInfo.PersistentAssemblyInfo = (PersistentAssemblyInfo)PersistentAssemblyInfo;
     _structPersistentClassInfo.SetDefaultTemplate(TemplateType.Struct);
     ClassGeneratorInfos.Add(_structPersistentClassInfo.Name, new ClassGeneratorInfo(StructPersistentClassInfo, DbTable));
 }
开发者ID:jdraith1,项目名称:eXpand,代码行数:13,代码来源:MapperContexts.cs

示例14: 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

示例15: GetSession

 /// <summary>
 /// Gets the session.
 /// </summary>
 /// <param name="objectSpace">The object space.</param>
 /// <param name="packageSession">The package session.</param>
 /// <returns>New external protocol session</returns>
 public static ExternalProtocolSession GetSession(IObjectSpace objectSpace, PackageSession packageSession)
 {
     var result =
         objectSpace.FindObject<ExternalProtocolSession>(
             CriteriaOperator.Parse("SessionId = ?", packageSession.SessionId), true);
     if(result == null)
     {
         result = objectSpace.CreateObject<ExternalProtocolSession>();
         result.SessionId = packageSession.SessionId;
         result.Route = packageSession.Route;
         result.StartedOn = packageSession.StartedOn;
         result.CommitedOn = packageSession.CommitedOn;
         if (packageSession.Parent != null)
             result.Parent = GetSession(objectSpace, packageSession.Parent);
     }
     return result;
 }
开发者ID:xafdelta,项目名称:xafdelta,代码行数:23,代码来源:ExternalProtocolSession.cs


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