Dispose() 공개 메소드

Disposes the specified discard changes.
public Dispose ( bool discardChanges ) : void
discardChanges bool if set to true [discard changes].
리턴 void
예제 #1
0
		public void DicardingChanges()
		{
			Post.DeleteAll();
			Blog.DeleteAll();

			SessionScope scope = new SessionScope(FlushAction.Never);
			
			Blog.FindAll(); // side effects only

			BlogService service = container.Resolve<BlogService>();
			Blog blog = service.Create( "name", "author" );
			
			Assert.AreEqual( 1, Blog.FindAll().Length );

			blog.Name = "joe developer";

			scope.Dispose();

			Assert.AreEqual( "name", Blog.FindAll()[0].Name );
		}
예제 #2
0
		public void DicardingChanges()
		{
			Post.DeleteAll();
			Blog.DeleteAll();

			SessionScope scope = new SessionScope();
			
			Blog.FindAll(); // side effects only

			BlogService service = (BlogService) container[ typeof(BlogService) ];
			Blog blog = service.Create( "name", "author" );
			
			Assert.AreEqual( 1, Blog.FindAll().Length );

			blog.Name = "joe developer";

			scope.Dispose(true);

			Assert.AreEqual( "name", Blog.FindAll()[0].Name );
		}
		/// <summary>
		/// Libera um <see cref="ISessionScope"/> do <c>ActiveRecord</c>.
		/// É chamado toda vez que uma requisição é finalizada, no evento
		/// <see cref="HttpApplication.EndRequest"/>.
		/// </summary>
		protected virtual void DisposeActiveRecordSessionScope(SessionScope scope)
		{
			scope.Dispose();
		}