当前位置: 首页>>代码示例>>C#>>正文


C# Provider类代码示例

本文整理汇总了C#中Provider的典型用法代码示例。如果您正苦于以下问题:C# Provider类的具体用法?C# Provider怎么用?C# Provider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Provider类属于命名空间,在下文中一共展示了Provider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ViewModel

 public ViewModel()
 {
     Provider = new Provider();
     Messages = new ObservableCollection<Core.Message>();
     ActivateCommands();
     SendRequests();
 }
开发者ID:bizmonger,项目名称:Pickup,代码行数:7,代码来源:ViewModel.cs

示例2: AddProviderWithDefaultUser

    public void AddProviderWithDefaultUser(Provider provider, User user)
    {
        using (TransactionScope scope = new TransactionScope())
        {
            using (var dataContext = new HealthReunionEntities())
            {

                if (CheckIfUserNameExists(user.UserName))
                    throw new Exception("User name already exist");

                if(CheckIfProviderNameExists(provider.ProviderName))
                    throw new Exception("Provider name already exist");

                // Add provider enity
                dataContext.Providers.Add(provider);

                // Save changes so that it will insert records into database.
                dataContext.SaveChanges();

                user.ProviderId = provider.ProviderId;

                user.Password = EncryptDecrypt.EncryptData(user.Password, EncryptDecrypt.ReadCert());

                // Add user entity
                dataContext.Users.Add(user);

                dataContext.SaveChanges();

                // Complete the transaction if everything goes well.
                scope.Complete();
            }
        }
    }
开发者ID:nagyist,项目名称:ranjance26-HealthReunionProviderPortal,代码行数:33,代码来源:ProviderRepository.cs

示例3: RunParameters

 public RunParameters(XmlElement e, Provider<IAgent, string> agentProvider)
 {
     exePath = e.SelectSingleNode("./cmd").InnerText;
     workingDirectory = e.SelectSingleNode("./dir").InnerText;
     parameters = e.SelectSingleNode("./args").InnerText;
     agent = agentProvider(e.SelectSingleNode("./agent").InnerText);
 }
开发者ID:chrisforbes,项目名称:profiler,代码行数:7,代码来源:RunParameters.cs

示例4: Delegate_Leak_RemoveOnlyDelegate

        public void Delegate_Leak_RemoveOnlyDelegate()
        {
            freeAll();

            var memBegin = Process.GetCurrentProcess().PrivateMemorySize64;
            Debug.WriteLine("Begin: " + (memBegin / 1000000));

            var provider = new Provider();
            var consumer = new Consumer(provider.Notify);

            freeAll();

            var afterCreation = Process.GetCurrentProcess().PrivateMemorySize64 - memBegin;
            Debug.WriteLine("After creation (should be around 200MB): " + (afterCreation / 1000000));

            provider = null;
            freeAll();

            var afterDispose = Process.GetCurrentProcess().PrivateMemorySize64 - memBegin;
            Debug.WriteLine("After dispose (should be around 200MB): " + (afterDispose / 1000000));

            consumer.RemoveDelegate();
            freeAll();

            var afterDispose2 = Process.GetCurrentProcess().PrivateMemorySize64 - memBegin;
            Debug.WriteLine("After consumer dispose (should be around 100MB): " + (afterDispose2 / 1000000));
        }
开发者ID:ttu,项目名称:scratchpad,代码行数:27,代码来源:MemoryLeakTests.cs

示例5: Config

 public Config()
 {
     CollectionPaths = null;
     DefinitionsCollection = new Definition[3];
     ProvidersCollection = new Provider[2];
     TrailerPath = "";
 }
开发者ID:flexage,项目名称:Trail-Blazer-Reloaded,代码行数:7,代码来源:Config.cs

示例6: Insert

 ///<summary>Inserts one Provider into the database.  Returns the new priKey.</summary>
 internal static long Insert(Provider provider)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         provider.ProvNum=DbHelper.GetNextOracleKey("provider","ProvNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(provider,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     provider.ProvNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(provider,false);
     }
 }
开发者ID:nampn,项目名称:ODental,代码行数:26,代码来源:ProviderCrud.cs

示例7: AddResourceProvider

        private bool AddResourceProvider(Provider provider, Dictionary<string, List<string>> locationMap)
        {
            if (locationMap == null || provider == null)
            {
                return false;
            }

            var providersLocations = provider.ResourceTypes
                .CoalesceEnumerable()
                .SelectMany(type => type.Locations)
                .Distinct(StringComparer.InvariantCultureIgnoreCase);

            providersLocations.ForEach(location =>
            {
                if (!locationMap.ContainsKey(location))
                {
                    locationMap[location] = new List<string>();
                }
                if (!locationMap[location].Contains(provider.NamespaceProperty))
                {
                    locationMap[location].Add(provider.NamespaceProperty);
                }
            });

            return true;
        }
开发者ID:devigned,项目名称:azure-powershell,代码行数:26,代码来源:GetAzureLocationCmdlet.cs

示例8: ConvertProviders

        private void ConvertProviders(Provider provider, Managed.Database.Provider newProvider)
        {
            newProvider.Name = provider.Name;
            newProvider.Description = provider.Description;
            newProvider.Web = provider.Web;
            newProvider.Pinned = provider.Pinned;

            foreach (var media in provider.Medias) {
                var stream = new Stream { Name = media.Name, Description = media.Description, Web = media.Web, ChatEmbed = media.ChatEmbed, StreamGuid = media.StreamGuid, StreamEmbed = media.StreamEmbed, Tags = media.Tags, Size = media.Size };
                foreach (var newEmbedData in media.ChatEmbedData.Select(embedData => new StreamDeskProperty { Name = embedData.Name, Value = embedData.Value }))
                {
                    stream.ChatEmbedData.Add(newEmbedData);
                }
                foreach (var newEmbedData in media.StreamEmbedData.Select(embedData => new StreamDeskProperty { Name = embedData.Name, Value = embedData.Value }))
                {
                    stream.StreamEmbedData.Add(newEmbedData);
                }
                newProvider.Streams.Add(stream);
            }

            foreach (var subProvider in provider.SubProviders)
            {
                var newSubProvider = new Managed.Database.Provider();
                ConvertProviders(subProvider, newSubProvider);
                newProvider.SubProviders.Add(newSubProvider);
            }
        }
开发者ID:StreamDesk,项目名称:StreamDesk-old,代码行数:27,代码来源:XML.cs

示例9: FindCitiesWithRadius

        public void FindCitiesWithRadius()
        {
            var providerCoventry = new Provider() { Name = "Coventry", Location = new Location() { Lat = 52.406822, Long = -1.519692999999961 }, Radius = 30 };
            var rugby = new Location()
                                 {
                                     Lat = 52.370878,
                                     Long = -1.2650320000000193
            };

            var warwik = new Location()
            {
                Lat = 52.28231599999999,
                Long = -1.5849269999999933
            };
            var leicester = new Location(){Lat = 52.6368778,Long = -1.1397591999999577};

            var london = new Location() { Lat = 51.5073509, Long = -0.12775829999998223 };

            var calculator = new Calculator();

            // Rugby and Warwik is closer than 30 km to Coventry
            var rugby_yes = calculator.IsWithin(rugby, providerCoventry.Location, providerCoventry.Radius);
            var warwik_yes = calculator.IsWithin(warwik, providerCoventry.Location, providerCoventry.Radius);

            // Leicester is further away than 30 km
            var leicester_no = calculator.IsWithin(leicester, providerCoventry.Location, providerCoventry.Radius);

            Assert.IsTrue(rugby_yes);
            Assert.IsTrue(warwik_yes);
            Assert.IsFalse(leicester_no);


        }
开发者ID:froberg,项目名称:FindProviders,代码行数:33,代码来源:UnitTest1.cs

示例10: EditNodeForm

 /// <summary>
 /// Initializes a new instance of the <see cref="EditNodeForm"/> class. 
 /// </summary>
 /// <param name="provider">
 /// The provider. 
 /// </param>
 /// <param name="oldVertexId">
 /// The old vertex id. 
 /// </param>
 public EditNodeForm(Provider.Provider provider, string oldVertexId)
 {
     this.InitializeComponent();
     this.provider = provider;
     this.oldVertexId = oldVertexId;
     this.FillForm();
 }
开发者ID:janas,项目名称:individual,代码行数:16,代码来源:EditNodeForm.cs

示例11: Instance

        /// <summary>
        /// 根据提供者信息,创建实现类
        /// </summary>
        /// <param name="dataProvider"></param>
        /// <returns></returns>
        public static Object Instance(Provider dataProvider)
        {
            if (dataProvider == null)
            {
                throw new Exception("Provider不存在,请确认配置文件中的节点Provider中的信息");
            }
            Type type = Type.GetType(dataProvider.Type);
            object newObject = null;
            if (type != null)
            {
                string connectionString = null;
                string databaseOwner = null;
                GetDataStoreParameters(dataProvider, out connectionString, out databaseOwner);
                newObject = Activator.CreateInstance(type, connectionString, databaseOwner);
                if (newObject == null)
                {
                    throw new Exception("建立实例出错");
                }
            }
            else
            {
                throw new Exception("加载类型出错");
            }

            return newObject;
        }
开发者ID:shaohaiou,项目名称:comopp,代码行数:31,代码来源:DataProvider.cs

示例12: btnSave_Click

        protected void btnSave_Click(object sender, EventArgs e)
        {
            try {
            //1st save off the region
            _selectedRegion.Title = txtTitle.Text.Trim();
            _selectedRegion.ProviderId = int.Parse(ddlProvider.SelectedValue);
            _selectedRegion.TemplateRegionId = int.Parse(ddlTemplateRegion.SelectedValue);
            int sortOrder = 1;
            int.TryParse(txtSortOrder.Text, out sortOrder);
            _selectedRegion.SortOrder = sortOrder;
            _selectedRegion.ShowTitle = chkShowTitle.Checked;
            _selectedRegion.Save(WebUtility.GetUserName());

            //2nd join it up with the page
            int rowsAffected = new RegionController().JoinToPage(_selectedRegion.RegionId, pageId);

            Provider provider = new Provider(int.Parse(ddlProvider.SelectedValue));
            Response.Redirect(string.Format("~/admin/provider.aspx?pageId={0}&regionId={1}&providerId={2}", pageId, _selectedRegion.RegionId, provider.ProviderId), true);
              }
              catch (System.Threading.ThreadAbortException) {
              throw;
              }
              catch(Exception ex) {
            Logger.Error(typeof(region).Name, ex);
            Master.MessageCenter.DisplayCriticalMessage(ex.Message);
              }
        }
开发者ID:freecin,项目名称:dashcommerce-3,代码行数:27,代码来源:region.aspx.cs

示例13: GetSettings

        public GlobalSettings GetSettings(Provider? provider)
        {
            var key = string.Format("GlobalSettingsFor{0}", provider);

            var global = (GlobalSettings) MemoryCache.Default.Get(key);

            if (global != null)
                return global;

            using (var session = nhibernateSessionFactory.OpenSession())
            {
                var settings = session.Query<Setting>().Where(x => x.Provider == provider || x.Provider == null).ToList();
                ProviderSettings providerSettings = null;

                if (provider.HasValue)
                {
                    providerSettings = session.Query<ProviderSettings>().FirstOrDefault(p => p.Provider == provider);
                }

                global = new GlobalSettings(settings, providerSettings);
            }

            MemoryCache.Default.Set(key, global, DateTimeOffset.Now.AddMinutes(5));

            return global;
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:26,代码来源:GlobalSettingsService.cs

示例14: Symmetric

        /// <summary>
        ///     Instantiates a new symmetric encryption object using the specified provider.
        /// </summary>
        //public Symmetric(Provider provider)
        //{
        //    this.Symmetric(provider,true);
        //}
        public Symmetric(Provider provider, bool useDefaultInitializationVector)
        {
            switch (provider)
            {
                case Provider.DES:
                    _crypto = new DESCryptoServiceProvider();
                    break;
                case Provider.RC2:
                    _crypto = new RC2CryptoServiceProvider();
                    break;
                case Provider.Rijndael:
                    _crypto = new RijndaelManaged();
                    break;
                case Provider.TripleDES:
                    _crypto = new TripleDESCryptoServiceProvider();
                    break;
            }

            //-- make sure key and IV are always set, no matter what
            Key = RandomKey();
            if (useDefaultInitializationVector)
            {
                IntializationVector = new Data(_DefaultIntializationVector);
            }
            else
            {
                IntializationVector = RandomInitializationVector();
            }
        }
开发者ID:hiriumi,项目名称:EasyReporting,代码行数:36,代码来源:Symmetric.cs

示例15: GetProviderHost

 private static string GetProviderHost(Provider provider)
 {
     switch (provider)
     {
         default:
             return "cache-aws-us-east-1";
     }
 }
开发者ID:acropolium,项目名称:Rest4Net,代码行数:8,代码来源:IronCacheProvider.cs


注:本文中的Provider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。