Exemplo n.º 1
0
        ProviderContext GetDataContext()
        {
            var dataContext = CallContext.Current.GetObject <ProviderContext>(ObjectKey);

            if (dataContext == null)
            {
                if (string.IsNullOrEmpty(ConnectionString))
                {
                    dataContext = new ProviderContext();
                }
                else
                {
                    dataContext = new ProviderContext(ConnectionString);
                }
                CallContext.Current.RegisterObject <ProviderContext>(ObjectKey, dataContext);
            }
            return(dataContext);
        }
Exemplo n.º 2
0
        ProviderContext GetDataContext()
        {
            var dataContext = CallContext.Current.GetObject<ProviderContext>(ObjectKey);

            if (dataContext == null)
            {
                if (string.IsNullOrEmpty(ConnectionString))
                {
                    dataContext = new ProviderContext();
                }
                else
                {
                    dataContext = new ProviderContext(ConnectionString);
                }
                CallContext.Current.RegisterObject<ProviderContext>(ObjectKey, dataContext);
            }
            return dataContext;
        }