Exemple #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);
        }
Exemple #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;
        }