Пример #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);
        }
Пример #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;
        }