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


C# IUnitOfWork.Dispose方法代码示例

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


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

示例1: EndUnitOfWork

		public void EndUnitOfWork(IUnitOfWork unitOfWork)
		{
			var nhUnitOfWork = unitOfWork as NHibernateUnitOfWork;
			if ( unitOfWork != null )
			{
				unitOfWork.Dispose();
				unitOfWork = null;
			}
		}
开发者ID:zpyang2005,项目名称:generic-repository,代码行数:9,代码来源:NHibernateUnitOfWorkFactory.cs

示例2: CreateUser

        public void CreateUser()
        {
            _repo = DependencyResolver.Current.GetService<IUnitOfWork>();

            var rolesID = this.SelectedRoles;

            var roleName = new string[] { };

            try
            {
                WebSecurity.CreateUserAndAccount(this.User.Email, "123456");
                this.User.ID =  WebSecurity.GetUserId(this.User.Email);
                _repo.UserRepository.Update(this.User);

                var allRoles = _repo.RolesRepository.GetAll();

                _repo.Save();

                roleName = allRoles.Select(i => i.RoleName).ToArray<string>();

                if (rolesID == null || rolesID.Count() == 0)
                {
                    return;
                }
                var roleNameAdd = (from a in allRoles
                                   from i in rolesID
                                   where a.RoleId == i
                                   select a.RoleName).ToArray<string>();

                Roles.AddUserToRoles(User.Email, roleNameAdd);
                

            }
            finally
            {
                _repo.Dispose();
            }

        }
开发者ID:munk1,项目名称:TGZStore,代码行数:39,代码来源:UsersAdminModel.cs

示例3: UpdateRoles

        public void UpdateRoles(IEnumerable<int> rolesID)
        {
             _repo = DependencyResolver.Current.GetService<IUnitOfWork>();


            var roleName = new string[]{};

            try
            {
                var allRoles  = _repo.RolesRepository.GetAll();

                roleName = allRoles.Select(i => i.RoleName).ToArray<string>();

                var CurrentUserRoles = Roles.GetRolesForUser(User.Email);

                if (CurrentUserRoles != null && CurrentUserRoles.Count() != 0)
                {
                    Roles.RemoveUserFromRoles(User.Email, Roles.GetRolesForUser(User.Email));    
                }

                if (rolesID == null || rolesID.Count() == 0)
                {
                    return;
                }
                var roleNameAdd = (from a in allRoles
                                   from i in rolesID
                                   where a.RoleId == i
                                   select a.RoleName).ToArray<string>();

                Roles.AddUserToRoles(User.Email, roleNameAdd);

            }
            finally
            {
                _repo.Dispose();
            }

        }
开发者ID:munk1,项目名称:TGZStore,代码行数:38,代码来源:UsersAdminModel.cs

示例4: UserEdit

        public UserEdit(int UserID)
            : base(UserID)
        {
            _repo = DependencyResolver.Current.GetService<IUnitOfWork>();
            try
            {
               AllRoles = _repo.RolesRepository.GetAll();

            }
            finally
            {
                _repo.Dispose();
            }
            
        }
开发者ID:munk1,项目名称:TGZStore,代码行数:15,代码来源:UsersAdminModel.cs

示例5: UserDetails

 public UserDetails(int UserID)
 {
     repo = DependencyResolver.Current.GetService<IUnitOfWork>();
     try
     {
         User = repo.UserRepository.GetById(UserID);
         UserRoles = User.webpages_Roles.AsEnumerable();
     }
     catch (Exception ex)
     {
         Logger.Instance.Error(ex.Message);
     }
     finally
     {
         repo.Dispose();
     }
     
 }
开发者ID:munk1,项目名称:TGZStore,代码行数:18,代码来源:UsersAdminModel.cs

示例6: ProcessExcelSheet


//.........这里部分代码省略.........
                                if (co == null)
                                {
                                    co = new ConsultantOrder
                                    {
                                        OrderId = orderId,
                                        Amount = amount,
                                        ItemCode = itemCode.Trim(),
                                        ItemName = itemName.Trim(),
                                        MRP = MRP,
                                        OrdQty = ordQty,
                                        ConsultantPrice = consPrice,
                                        Status = status,
                                        Consultant = uc

                                    };

                                    co.VoucherId = j + 1;
                                    j++;

                                    if (uc != null)
                                    {
                                        //prevId = co.OrderId;
                                        //prevVoucherId = co.VoucherId;
                                        uc.ConsultantOrders.Add(co);
                                        uc.ConsultantOrders.OrderBy(x => x.OrderId).ThenBy(x => x.ItemName);
                                    }
                                }

                            }
                        }

                    }
                    objXmlWriter2.Flush();
                    objXmlWriter2.Dispose();
                }

                
                foreach (var unit in units)
                
                {
                    unitOfWork = new UnitOfWork();
                    XmlWriter objXmlWriter3 = XmlWriter.Create(new BufferedStream
                                               (new FileStream(savePath + "//payment.xml", FileMode.Append, System.Security.AccessControl.FileSystemRights.Write,
                                               FileShare.None, 16384, FileOptions.SequentialScan)),
                                               new XmlWriterSettings
                                               {
                                                   Indent = true,
                                                   CloseOutput = true,
                                                   OmitXmlDeclaration = true,
                                                   WriteEndDocumentOnClose = false,
                                                   ConformanceLevel = ConformanceLevel.Fragment
                                               });
                    using (objXmlWriter3)
                    {
                        foreach (var uCon in unit.UnitConsultants)
                        {
                            string consultant = uCon.Consultant + " - " + uCon.ConsultantId;

                            //newVoucherNo = newVoucherNo + 1;
                            objXmlWriter3.WriteStartElement("TALLYMESSAGE"); objXmlWriter3.WriteAttributeString("xmlns", "UDF", null, "TallyUDF");
                            objXmlWriter3.WriteStartElement("LEDGER"); objXmlWriter3.WriteAttributeString("NAME", consultant); objXmlWriter3.WriteAttributeString("RESERVEDNAME", "");
                            objXmlWriter3.WriteStartElement("ADDRESS.LIST"); objXmlWriter3.WriteAttributeString("TYPE", "String"); objXmlWriter3.WriteElementString("ADDRESS", unit.Unit);
                            objXmlWriter3.WriteElementString("ADDRESS", assembly); objXmlWriter3.WriteEndElement(); objXmlWriter3.WriteStartElement("MAILINGNAME.LIST");
                            objXmlWriter3.WriteAttributeString("TYPE", "String"); objXmlWriter3.WriteElementString("MAILINGNAME", consultant); objXmlWriter3.WriteEndElement();
                            objXmlWriter3.WriteStartElement("OLDAUDITENTRYIDS.LIST"); objXmlWriter3.WriteAttributeString("TYPE", "Number"); objXmlWriter3.WriteElementString("OLDAUDITENTRYIDS", "-1");
                            objXmlWriter3.WriteEndElement(); objXmlWriter3.WriteElementString("ALTEREDON", model.Date); objXmlWriter3.WriteElementString("STATENAME", "Maharashtra");
开发者ID:ericnzai,项目名称:xmldata,代码行数:67,代码来源:ConvertInvoiceVoucherToXmlService.cs

示例7: GetSynchedDataToDB

		private async void GetSynchedDataToDB(Action dbSyncStart, Action dbSyncEnd)
		{

			var apiNotebooks = await Kernel.Get<INotebookAPICaller>().GetList(Configs.NotebooksAPI_Notebooks_Get);

			var apiNotes = await Kernel.Get<INoteAPICaller>().GetList(Configs.NotebooksAPI_Notes_Get);

			dbSyncStart();

			//TODO:: here display msg to User...that his data is getting synched && also should stop all actions on UI

			_unitOfWork.Dispose();
			_unitOfWork = new UnitOfWork();
			_unitOfWork.NotebooksRepository.EraseAll();
			_unitOfWork.NotesRepository.EraseAll();

			foreach (var nb in apiNotebooks)
			{
				_unitOfWork.NotebooksRepository.Add(nb);
			}
			foreach (var note in apiNotes)
			{
				_unitOfWork.NotesRepository.Add(note);
			}

			_unitOfWork.Dispose();

			//here end msg
			dbSyncEnd();
		}
开发者ID:Ferencz8,项目名称:RepeatApp,代码行数:30,代码来源:Syncronizer.cs

示例8: CanDisposeUnitOfWork

 public void CanDisposeUnitOfWork()
 {
     _unitOfWork = UnitOfWorkController.Start(_manager);
     _unitOfWork.Dispose();
 }
开发者ID:splotter,项目名称:Splotter-Common,代码行数:5,代码来源:UnitOfWorkControllerTest.cs

示例9: DisposeUnitOfWork

 public void DisposeUnitOfWork(IUnitOfWork unitOfWork)
 {
     unitOfWork.Dispose();
     CurrentUnitOfWork = null;
 }
开发者ID:dhilgarth,项目名称:fd.Base,代码行数:5,代码来源:UnitOfWorkFactory.cs


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