This is a migrated thread and some comments may be shown as answers.

Can't find Provider

12 Answers 448 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 15 Feb 2008, 06:40 PM
I'm trying to get a basic Schedule running, but I'm getting an error:

Provider 'SchedulerData' has not been declared in web.config

Here is my web.config section that defines it:

<configuration> 
    <configSections> 
    <sectionGroup name="telerik.web.ui">  
      <section name="radScheduler" type="Telerik.Web.UI.RadSchedulerConfigurationSection, Telerik.Web.UI, PublicKeyToken=121fae78165ba3d4" allowDefinition="MachineToApplication"/>  
    </sectionGroup> 
    </configSections> 
  <telerik.web.ui> 
    <radScheduler defaultAppointmentProvider="Integrated">  
      <appointmentProviders> 
        <add name="SchedulerData" type="Telerik.Web.Scheduler.MyDbSchedulerProvider" connectionStringName="LocalSqlServer" persistChanges="true" /> 
      </appointmentProviders> 
    </radScheduler> 
  </telerik.web.ui> 
    <appSettings/> 
    <connectionStrings> 
        <remove name="LocalSqlServer"/>  
        <add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|sc.mdf"/>  
    </connectionStrings> 

and here's the very basic tag I'm using to initiate it:

<telerik:RadScheduler runat="server" ID="RadScheduler1" SelectedView="Month" DayStartTime="08:00:00" DayEndTime="18:00:00" ProviderName="SchedulerData" ReadOnly="false"

Can anyone see what I'm doing wrong? I'm using the MyDbSchedulerProvider.cs file that was included and I've changed it to match up to my database table and fields. Thanks.

12 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 18 Feb 2008, 03:30 PM
Hi Philip,

We are not sure why this problem occurs. Could you please send us a small demo project which includes the provider and the web.config files. We will test it locally and probably find the cause of the problem.


Regards,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Fabio Honigmann
Top achievements
Rank 2
answered on 02 May 2008, 02:25 PM
I am having the same problem.

I have slightly modified the DbSchedulerProvider to fit my current data model, i setup everything as the documentation tells me to.

The first time i run the page after i make changes to my config file i get the error;
Expecting non-empty string for 'providerInvariantName' parameter.

But if i refresh the page the error changes to ;
System.ArgumentException: Provider 'CyrusEventProvider' has not been declared in web.config.

That happens until I re-save my webconfig and i start get the first error again, refresh 2nd error.....


Can anyone tell me whats going on?


EventSchedulerProvider.cs
using System; 
using System.Collections.Generic; 
using System.Data.Common; 
using Telerik.Web.UI; 
 
namespace Cyrus.Library.Providers 
    public class EventSchedulerProvider : DbSchedulerProviderBase 
    { 
 
        public override IEnumerable<Appointment> GetAppointments(RadScheduler owner) 
        { 
            List<Appointment> appointments = new List<Appointment>(); 
 
            using (DbConnection conn = OpenConnection()) 
            { 
                DbCommand cmd = DbFactory.CreateCommand(); 
                cmd.Connection = conn; 
                cmd.CommandText = "SELECT [Id], [Name], [StartDateTime], [EndDateTime], [RecurrenceRule], [RecurrenceParentId] FROM [Cyrus_Event2]"
 
                using (DbDataReader reader = cmd.ExecuteReader()) 
                { 
                    while (reader.Read()) 
                    { 
                        Appointment apt = new Appointment(); 
                        apt.Owner = owner; 
                        apt.ID = reader["Id"]; 
                        apt.Subject = Convert.ToString(reader["Name"]); 
                        apt.Start = DateTime.SpecifyKind(Convert.ToDateTime(reader["StartDateTime"]), DateTimeKind.Utc); 
                        apt.End = DateTime.SpecifyKind(Convert.ToDateTime(reader["EndDateTime"]), DateTimeKind.Utc); 
                        apt.RecurrenceRule = Convert.ToString(reader["RecurrenceRule"]); 
                        apt.RecurrenceParentID = reader["RecurrenceParentId"] == DBNull.Value ? null : reader["RecurrenceParentId"]; 
 
                        if (apt.RecurrenceParentID != null
                        { 
                            apt.RecurrenceState = RecurrenceState.Exception; 
                        } 
                        else 
                            if (apt.RecurrenceRule != string.Empty) 
                            { 
                                apt.RecurrenceState = RecurrenceState.Master; 
                            } 
 
                        appointments.Add(apt); 
                    } 
                } 
            } 
 
            return appointments; 
        } 
 
        public override void Insert(RadScheduler owner, Appointment appointmentToInsert) 
        { 
            if (!PersistChanges) 
            { 
                return
            } 
 
            using (DbConnection conn = OpenConnection()) 
            { 
                using (DbTransaction tran = conn.BeginTransaction()) 
                { 
                    DbCommand cmd = DbFactory.CreateCommand(); 
                    cmd.Connection = conn; 
                    cmd.Transaction = tran; 
 
                    PopulateAppointmentParameters(cmd, appointmentToInsert); 
 
                    cmd.CommandText = 
                        @"  INSERT  INTO [Cyrus_Event2]
                                    ([Id], [Name], [StartDateTime], [EndDateTime], [RecurrenceRule], [RecurrenceParentID])
                            VALUES  (NEWID(), @Name, @StartDateTime, @EndDateTime, @RecurrenceRule, @RecurrenceParentID)"
 
                    cmd.ExecuteNonQuery(); 
 
                    tran.Commit(); 
                } 
            } 
        } 
 
        public override void Update(RadScheduler owner, Appointment appointmentToUpdate) 
        { 
            if (!PersistChanges) 
            { 
                return
            } 
 
            using (DbConnection conn = OpenConnection()) 
            { 
                using (DbTransaction tran = conn.BeginTransaction()) 
                { 
                    DbCommand cmd = DbFactory.CreateCommand(); 
                    cmd.Connection = conn; 
                    cmd.Transaction = tran; 
 
                    PopulateAppointmentParameters(cmd, appointmentToUpdate); 
 
                    cmd.Parameters.Add(CreateParameter("@Id", appointmentToUpdate.ID)); 
                    cmd.CommandText = "UPDATE [Cyrus_Event2] SET [Name] = @Name, [StartDateTime] = @StartDateTime, [EndDateTime] = @EndDateTime, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID WHERE [Id] = @Id"
                    cmd.ExecuteNonQuery(); 
 
                    tran.Commit(); 
                } 
            } 
        } 
 
        public override void Delete(RadScheduler owner, Appointment appointmentToDelete) 
        { 
            if (!PersistChanges) 
            { 
                return
            } 
 
            using (DbConnection conn = OpenConnection()) 
            { 
                DbCommand cmd = DbFactory.CreateCommand(); 
                cmd.Connection = conn; 
 
                using (DbTransaction tran = conn.BeginTransaction()) 
                { 
                    cmd.Transaction = tran; 
 
                    cmd.Parameters.Clear(); 
                    cmd.Parameters.Add(CreateParameter("@Id", appointmentToDelete.ID)); 
                    cmd.CommandText = "DELETE FROM [Cyrus_Event2] WHERE [Id] = @Id"
                    cmd.ExecuteNonQuery(); 
 
                    tran.Commit(); 
                } 
            } 
        } 
 
        private void PopulateAppointmentParameters(DbCommand cmd, Appointment apt) 
        { 
            cmd.Parameters.Add(CreateParameter("@Name", apt.Subject)); 
            cmd.Parameters.Add(CreateParameter("@StartDateTime", apt.Start)); 
            cmd.Parameters.Add(CreateParameter("@EndDateTime", apt.End)); 
 
            string rrule = null
            if (apt.RecurrenceRule != string.Empty) 
            { 
                rrule = apt.RecurrenceRule; 
            } 
            cmd.Parameters.Add(CreateParameter("@RecurrenceRule", rrule)); 
 
            object parentId = null
            if (apt.RecurrenceParentID != null
            { 
                parentId = apt.RecurrenceParentID; 
            } 
            cmd.Parameters.Add(CreateParameter("@RecurrenceParentId", parentId)); 
        } 
 
        public override IEnumerable<ResourceType> GetResourceTypes(RadScheduler owner) 
        { 
            throw new NotImplementedException(); 
        } 
 
        public override IEnumerable<Resource> GetResourcesByType(RadScheduler owner, string resourceType) 
        { 
            throw new NotImplementedException(); 
        } 
    } 
 


web.config
    <configSections> 
        <sectionGroup name="telerik.web.ui"
            <section name="radScheduler" type="Telerik.Web.UI.RadSchedulerConfigurationSection, Telerik.Web.UI, PublicKeyToken=121fae78165ba3d4" allowDefinition="MachineToApplication" requirePermission="false"/> 
        </sectionGroup> 
    </configSections> 
 
 
    <telerik.web.ui> 
        <radScheduler defaultAppointmentProvider="Integrated"
            <appointmentProviders> 
                <add name="CyrusEventProvider" 
                    type="Cyrus.Library.Providers.EventSchedulerProvider" 
                    connectionStringName="Cyrus" 
                    persistChanges="true" /> 
            </appointmentProviders> 
        </radScheduler> 
    </telerik.web.ui> 
 

Default.aspx
 
        <telerik:RadScheduler runat="server" ID="RadScheduler1" 
            ProviderName="CyrusEventProvider"  
            Width="750px" 
            SelectedView="MonthView" 
            DayStartTime="07:00:00"  
            DayEndTime="17:00:00"
            <AppointmentTemplate> 
                <%# Eval("Name") %> 
            </AppointmentTemplate> 
        </telerik:RadScheduler> 
 


Thanks,

Fabio Honigmann

0
Philip Senechal
Top achievements
Rank 1
answered on 03 May 2008, 03:29 PM
It's your provider or database declaration in your web.config file. Here's the pertinent sections from mine to use as an example:

<configuration> 
    <configSections> 
        <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
            <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
                <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
                <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
                    <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/> 
                    <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
                    <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
                    <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
                </sectionGroup> 
            </sectionGroup> 
        </sectionGroup> 
        <sectionGroup name="telerik.web.ui"
            <section name="radScheduler" type="Telerik.Web.UI.RadSchedulerConfigurationSection, Telerik.Web.UI, PublicKeyToken=121fae78165ba3d4" allowDefinition="MachineToApplication"/> 
        </sectionGroup> 
    </configSections> 
    <telerik.web.ui> 
        <radScheduler defaultAppointmentProvider="Integrated"
            <appointmentProviders> 
                <add name="SchedulerData" type="Telerik.Web.Scheduler.MyDbSchedulerProvider" connectionStringName="LocalSqlServer" persistChanges="true"/> 
            </appointmentProviders> 
        </radScheduler> 
    </telerik.web.ui> 
    <appSettings/> 
    <connectionStrings> 
        <remove name="LocalSqlServer"/> 
        <add name="LocalSqlServer" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|sc.mdf"/> 
    </connectionStrings> 

0
Peter
Telerik team
answered on 06 May 2008, 07:57 AM

Philip, thanks for joining this thread with a suggestion. I hope this helps Fabio.


Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Philip Senechal
Top achievements
Rank 1
answered on 06 May 2008, 01:04 PM
Just hoping others can benefit from my mistakes :)
0
Fabio Honigmann
Top achievements
Rank 2
answered on 06 May 2008, 01:08 PM
I found the problem, it was pretty silly but all i had to do was add (providerName="System.Data.SqlClient") to my connection string, and BANG it worked.

Thanks,

Fabio
0
ephillipe
Top achievements
Rank 2
answered on 03 Nov 2009, 04:45 PM
Hi,
I testing last RadScheduler from site e I'm getting the same problem.

Provider 'DatabaseSchedulerData' has not been declared in web.config.


I rewrite my provider for use, my Entity Framewwork. But is is not working. 
This post is old, any solution found?  :D

Thanks!
0
Philip Senechal
Top achievements
Rank 1
answered on 03 Nov 2009, 04:51 PM
ephillipe...

Check the connection string to your database in the web.config file. Make sure you have a providerName declared like the following

<add name="LocalSqlServer" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|sc.mdf"/>  
0
ephillipe
Top achievements
Rank 2
answered on 03 Nov 2009, 05:01 PM
Hi Phillip.
I don't use a original ResourceProvider. My provider use Entity Framwork connection. For a litle example, I paste pieces of my Web.config and ResourceProvider.

web.config (Provider config)
  <telerik.web.ui> 
    <radCompression enablePostbackCompression="true"/> 
    <radScheduler defaultAppointmentProvider="Integrated"
      <appointmentProviders> 
        <add name="DatabaseSchedulerData" type="Domminii.Providers.SchedulerDatabaseProvider" persistChanges="true" /> 
      </appointmentProviders> 
    </radScheduler> 
  </telerik.web.ui> 

web.config (connections config)
  <connectionStrings> 
    <add name="EntitiesEscritorio" connectionString="metadata=res://*/Escritorio.csdl|res://*/Escritorio.ssdl|res://*/Escritorio.msl;provider=Devart.Data.PostgreSql;provider connection string=&quot;User Id=domminii3;Password=XPTO;Host=localhost;Database=domminii3;Persist Security Info=True;Connection Timeout=60;Schema=escritorio&quot;" providerName="System.Data.EntityClient"/> 
    <add name="EntitiesCrm" connectionString="metadata=res://*/Crm.csdl|res://*/Crm.ssdl|res://*/Crm.msl;provider=Devart.Data.PostgreSql;provider connection string=&quot;User Id=domminii3;Password=XPTO;Host=localhost;Database=domminii3;Persist Security Info=True;Connection Timeout=60;Schema=crm&quot;" providerName="System.Data.EntityClient"/> 
    <add name="EntitiesEstoque" connectionString="metadata=res://*/Estoque.csdl|res://*/Estoque.ssdl|res://*/Estoque.msl;provider=Devart.Data.PostgreSql;provider connection string=&quot;User Id=domminii3;Password=XPTO;Host=localhost;Database=domminii3;Persist Security Info=True;Connection Timeout=60;Schema=estoque&quot;" providerName="System.Data.EntityClient"/> 
    <add name="EntitiesEntidade" connectionString="metadata=res://*/Entidade.csdl|res://*/Entidade.ssdl|res://*/Entidade.msl;provider=Devart.Data.PostgreSql;provider connection string=&quot;User Id=domminii3;Password=XPTO;Host=localhost;Database=domminii3;Persist Security Info=True;Connection Timeout=60;Schema=entidade&quot;" providerName="System.Data.EntityClient"/> 
    <add name="domminii3EntitiesCaixa" connectionString="metadata=res://*/Caixa.csdl|res://*/Caixa.ssdl|res://*/Caixa.msl;provider=Devart.Data.PostgreSql;provider connection string=&quot;User Id=domminii3;Password=XPTO;Host=localhost;Database=domminii3;Persist Security Info=True;Connection Timeout=60;Schema=caixa&quot;" providerName="System.Data.EntityClient"/> 
    <add name="EntitiesTeocracia" connectionString="metadata=res://*/Teocracia.csdl|res://*/Teocracia.ssdl|res://*/Teocracia.msl;provider=Devart.Data.PostgreSql;provider connection string=&quot;User Id=domminii3;Password=XPTO;Host=localhost;Database=domminii3;Persist Security Info=True;Connection Timeout=60;Schema=teocracia&quot;" providerName="System.Data.EntityClient"/> 
    <add name="EntitiesFinanceiro" connectionString="metadata=res://*/Financeiro.csdl|res://*/Financeiro.ssdl|res://*/Financeiro.msl;provider=Devart.Data.PostgreSql;provider connection string=&quot;User Id=domminii3;Password=XPTO;Host=localhost;Database=domminii3;Persist Security Info=True;Connection Timeout=60;Schema=financeiro&quot;" providerName="System.Data.EntityClient"/> 
  </connectionStrings> 

My modified Provider (piece of code)
    public class SchedulerDatabaseProvider : DbSchedulerProviderBase 
    { 
        private IDictionary<Guid, Resource> _salas; 
        private IDictionary<Guid, Resource> _usuarios; 
 
        private IDictionary<Guid, Resource> Salas 
        { 
            get 
            { 
                if (_salas == null
                { 
                    _salas = new Dictionary<Guid, Resource>(); 
                    foreach (Resource Sala in CarregarSalas()) 
                    { 
                        _salas.Add((Guid)Sala.Key, Sala); 
                    } 
                } 
 
                return _salas; 
            } 
        } 
 
        private IDictionary<Guid, Resource> Usuarios 
        { 
            get 
            { 
                _usuarios = new Dictionary<Guid, Resource>(); 
                foreach (Resource Usuario in CarregarUsuarios()) 
                { 
                    _usuarios.Add((Guid)Usuario.Key, Usuario); 
                } 
 
                return _usuarios; 
            } 
        } 
 
        public override IEnumerable<Appointment> GetAppointments(RadScheduler owner) 
        { 
            List<Appointment> appointments = new List<Appointment>(); 
            Guid empresaID = new Guid(HttpContext.Current.Session["eid"].ToString()); 
            using (var context = new EntitiesEscritorio()) 
            { 
                var agendamentos = context.Agenda.Where(a => a.Empresa.ID == empresaID).ToList(); 
                foreach (var item in agendamentos) 
                { 
                    Appointment apt = new Appointment(); 
                    CopyAppointmentFromAgenda(apt, item); 
                    if (apt.RecurrenceParentID != null
                    { 
                        apt.RecurrenceState = RecurrenceState.Exception; 
                    } 
                    else if (apt.RecurrenceRule != string.Empty) 
                    { 
                        apt.RecurrenceState = RecurrenceState.Master; 
                    } 
                    LoadResources(apt, context); 
                    appointments.Add(apt); 
                } 
            } 
            return appointments; 
        } 

The error alternates with below message:

Erro de configuração  
Descrição: Erro durante o processamento de um arquivo de configuração necessário para o serviço desta solicitação. Examine os detalhes específicos do erro e modifique esse arquivo de configuração apropriadamente.  
 
Mensagem de Erro do Analisador: The type 'Domminii.Providers.SchedulerDatabaseProvider' is ambiguous: it could come from assembly 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\e9b45c43\9284d8b9\App_Code.a5pwucgy.DLL' or from assembly 'D:\Pessoal\Desenvolvimento\SVN\Domminii\Gerenciador\Site\bin\Domminii.Site.DLL'. Please specify the assembly explicitly in the type name. 
 
Erro de Origem:  
 
 
Linha 134:    <radScheduler defaultAppointmentProvider="Integrated"
Linha 135:      <appointmentProviders> 
Linha 136:        <add name="DatabaseSchedulerData" type="Domminii.Providers.SchedulerDatabaseProvider" persistChanges="true" /> 
Linha 137:      </appointmentProviders> 
Linha 138:    </radScheduler> 
  
 
Arquivo de Origem: D:\Pessoal\Desenvolvimento\SVN\Domminii\Gerenciador\Site\web.config    Linha: 136  

Thanks for attention.
Erick Almeida.
0
ephillipe
Top achievements
Rank 2
answered on 03 Nov 2009, 07:02 PM
Hi All,

It's working now for me! :D
I change the inheritance of my class and Shazam!

Original:
public class SchedulerDatabaseProvider : DbSchedulerProviderBase  
 

Modified:
public class SchedulerDatabaseProvider : SchedulerProviderBase  
 

Thanks for help.

0
David
Top achievements
Rank 1
answered on 15 Mar 2012, 01:26 PM
I'm having this exact same issue but I'm trying to implement the custom provider into a DotNetNuke install. Not sure what's causing this error.

My connection string has the Provider set to SqlClient, Provider is declared appropriately, class names are ok. No idea why this occurring.
0
David
Top achievements
Rank 1
answered on 15 Mar 2012, 04:34 PM
<compilation debug="true" strict="false" explicit="true">
  <codeSubDirectories>
    <add directoryName="ProfileProvider" />
  </codeSubDirectories>
</compilation>
Actually managed to fix it by using a codeSubDirectories tag under <compilation> in the web.config. Provider had to be accessed from the App_Code folder. Class was C#, DotNetNuke is built on VB. The sub directory allows for compilation of the file and using it as a temporary assembly when the application is run.

Tags
Scheduler
Asked by
Philip
Top achievements
Rank 1
Answers by
Peter
Telerik team
Fabio Honigmann
Top achievements
Rank 2
Philip Senechal
Top achievements
Rank 1
ephillipe
Top achievements
Rank 2
David
Top achievements
Rank 1
Share this question
or