Returns an IDisposable scope, checks that ThreadDataManager is initialized for the current thread, if not - does the initialization. Should be called in all non ASP.NET threads, that are using C1 data API.

Namespace: Composite.Core.Threading
Assembly: Composite (in Composite.dll) Version: 6.1.6325.31818

Syntax

C#
public static IDisposable EnsureInitialize()
Visual Basic
Public Shared Function EnsureInitialize As IDisposable
Visual C++
public:
static IDisposable^ EnsureInitialize()

Return Value

An IDisposable scope

Examples

CopyC#
using (Composite.Core.Threading.ThreadDataManager.EnsureInitialize())
using (var conn = new DataConnection(PublicationScope.Published, new CultureInfo("en-US")))
{
  var pages = conn.Get<Composite.Data.Types.IPage>();    
  // ...
}

See Also