Binding to Database Example

37 posts, 0 answers
  1. Ventzi
    Admin
    Ventzi avatar
    114 posts

    Posted 05 Sep 2013 Link to this post

    Hi Mark,

     You are using an old version of the sample project. I've updated the projects in the first thread to point to the new version of the projects. In this version the VisibleRangeExecuted method behaves differently. Please download it and give it a try.

    Hope this is helpful.

    Regards,
    Ventzi
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  2. Mark
    Mark avatar
    155 posts
    Member since:
    Oct 2010

    Posted 05 Sep 2013 Link to this post

    Hi Ventzi,

    Thanks for taking the time to respond.  I'll download again and have a look.
    So hard to tell when a link changes as I'm sure you can appreciate.

    Kind regards,
    Mark
  3. Mark
    Mark avatar
    155 posts
    Member since:
    Oct 2010

    Posted 05 Sep 2013 Link to this post

    Hi Ventzi,

    Unfortunately I am unable to run the provided updated sample.  An error is generated as follows:
    System.Windows.Markup.XamlParseException occurred
      Message=The invocation of the constructor on type 'ScheduleView_DB_CS.ViewModel.ScheduleViewViewModel' that matches the specified binding constraints threw an exception. [Line: 11 Position: 37]
      LineNumber=11
      LinePosition=37
      StackTrace:
           at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
           at ScheduleView_DB_CS.MainPage.InitializeComponent()
           at ScheduleView_DB_CS.MainPage..ctor()
      InnerException: System.ArgumentException
           Message=The provided URI scheme 'file' is invalid; expected 'http'.
    Parameter name: via
           StackTrace:
                at System.ServiceModel.Channels.TransportChannelFactory`1.ValidateScheme(Uri via)
                at System.ServiceModel.Channels.HttpChannelFactory.ValidateCreateChannelParameters(EndpointAddress remoteAddress, Uri via)
                at System.ServiceModel.Channels.HttpChannelFactory.OnCreateChannel(EndpointAddress remoteAddress, Uri via)
                at System.ServiceModel.Channels.ChannelFactoryBase`1.InternalCreateChannel(EndpointAddress address, Uri via)
                at System.ServiceModel.Channels.ChannelFactoryBase`1.CreateChannel(EndpointAddress address, Uri via)
                at System.ServiceModel.Channels.ServiceChannelFactory.ServiceChannelFactoryOverRequest.CreateInnerChannelBinder(EndpointAddress to, Uri via)
                at System.ServiceModel.Channels.ServiceChannelFactory.CreateServiceChannel(EndpointAddress address, Uri via)
                at System.ServiceModel.Channels.ServiceChannelFactory.CreateChannel(Type channelType, EndpointAddress address, Uri via)
                at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via)
                at System.ServiceModel.ChannelFactory`1.CreateChannel()
                at System.ServiceModel.DomainServices.Client.WebDomainClient`1.BeginQueryCore(EntityQuery query, AsyncCallback callback, Object userState)
                at System.ServiceModel.DomainServices.Client.DomainClient.BeginQuery(EntityQuery query, AsyncCallback callback, Object userState)
                at System.ServiceModel.DomainServices.Client.DomainContext.Load(EntityQuery query, LoadBehavior loadBehavior, Action`1 callback, Object userState)
                at System.ServiceModel.DomainServices.Client.DomainContext.Load[TEntity](EntityQuery`1 query)
                at ScheduleView_DB_CS.ViewModel.ScheduleViewViewModel.LoadData()
                at ScheduleView_DB_CS.ViewModel.ScheduleViewViewModel..ctor()
           InnerException:

    If I simply try and recode the older demo, I still do not find that the historical data loads correctly after updating what I can identify from the newer sample.  If you would please advise.

    Thanks,
    Mark

    -----------
    UPDATE
    -----------
    This "updated" demo code also causes an exception within the designer causing it not to render which is the known RIA design time issue.

    In trying to understand your code, you have the following function:
    public static bool SaveData(Action action)
         {
         if (ScheduleViewRepository.Context.HasChanges && !ScheduleViewRepository.Context.IsSubmitting)
              {
                   try
                   {
                        ScheduleViewRepository.Context.SubmitChanges(OnSubmitChangesCompleted, action);
                        return true;
                   }
                   catch (System.Exception)
                   {
                         return false;
                   }
                }
                return false;        <-- This prevents loading history if there are no changes ??
          }

    It would seem that if there are no changes that the load does not fire when changing the current viewable date range.

    ---------------
    UPDATE 2
    ---------------
    I was able to make those minor adjustments on the Web properties page to get the newer sample to initially compile and launch
    (It seems the database schema has also changed since the earlier sample.)

    On starting the sample, however, I am presented with the following error:

    System.Data.EntityCommandCompilationException was unhandled by user code
      HResult=-2146232005
      Message=An error occurred while preparing the command definition. See the inner exception for details.
      Source=System.Data.Entity
      StackTrace:
           at System.Data.EntityClient.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree)
           at System.Data.EntityClient.EntityProviderServices.CreateCommandDefinition(DbProviderFactory storeProviderFactory, DbCommandTree commandTree)
           at System.Data.EntityClient.EntityProviderServices.CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
           at System.Data.Common.DbProviderServices.CreateCommandDefinition(DbCommandTree commandTree)
           at System.Data.Objects.Internal.ObjectQueryExecutionPlan.Prepare(ObjectContext context, DbQueryCommandTree tree, Type elementType, MergeOption mergeOption, Span span, ReadOnlyCollection`1 compiledQueryParameters, AliasGenerator aliasGenerator)
           at System.Data.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable`1 forMergeOption)
           at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
           at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
           at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
           at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
           at ScheduleView_DB_CS.Web.ScheduleViewDomainService.GetSqlAppointmentsIdsByRange(DateTime start, DateTime end) in C:\Users\Mark\Desktop\2115e45d-0e39-4227-82f7-69226f50ec9b_ScheduleView-DB-CS\ScheduleView_DB_CS.Web\ScheduleViewDomainService.cs:line 374
           at ScheduleView_DB_CS.Web.ScheduleViewDomainService.GetSqlAppointmentsByRange(DateTime start, DateTime end) in C:\Users\Mark\Desktop\2115e45d-0e39-4227-82f7-69226f50ec9b_ScheduleView-DB-CS\ScheduleView_DB_CS.Web\ScheduleViewDomainService.cs:line 62
           at GetSqlAppointmentsByRange(DomainService , Object[] )
           at System.ServiceModel.DomainServices.Server.ReflectionDomainServiceDescriptionProvider.ReflectionDomainOperationEntry.Invoke(DomainService domainService, Object[] parameters)
           at System.ServiceModel.DomainServices.Server.DomainOperationEntry.Invoke(DomainService domainService, Object[] parameters, Int32& totalCount)
           at System.ServiceModel.DomainServices.Server.DomainService.Query(QueryDescription queryDescription, IEnumerable`1& validationErrors, Int32& totalCount)
      InnerException: System.Data.MappingException
           HResult=-2146232032
           Message=
    ScheduleViewDataModel.msl(3,4) : error 3027: No mapping specified for the following EntitySet/AssociationSet - SqlAppointmentResources, SqlAppointments, SqlExceptionAppointments, SqlExceptionOccurrences, SqlExceptionResources, SqlResources, SqlResourceTypes.
           Source=System.Data.Entity
           StackTrace:
                at System.Data.Mapping.StorageMappingItemCollection.ViewDictionary.SerializedGenerateViews(StorageEntityContainerMapping entityContainerMap, Dictionary`2 resultDictionary)
                at System.Data.Mapping.StorageMappingItemCollection.ViewDictionary.SerializedGetGeneratedViews(EntityContainer container)
                at System.Data.Common.Utils.Memoizer`2.<>c__DisplayClass2.<Evaluate>b__0()
                at System.Data.Common.Utils.Memoizer`2.Result.GetValue()
                at System.Data.Common.Utils.Memoizer`2.Evaluate(TArg arg)
                at System.Data.Mapping.StorageMappingItemCollection.ViewDictionary.GetGeneratedView(EntitySetBase extent, MetadataWorkspace workspace, StorageMappingItemCollection storageMappingItemCollection)
                at System.Data.Metadata.Edm.MetadataWorkspace.GetGeneratedView(EntitySetBase extent)
                at System.Data.Query.PlanCompiler.PreProcessor.ExpandView(Node node, ScanTableOp scanTableOp, IsOfOp& typeFilter)
                at System.Data.Query.PlanCompiler.PreProcessor.ProcessScanTable(Node scanTableNode, ScanTableOp scanTableOp, IsOfOp& typeFilter)
                at System.Data.Query.PlanCompiler.PreProcessor.Visit(ScanTableOp op, Node n)
                at System.Data.Query.InternalTrees.ScanTableOp.Accept[TResultType](BasicOpVisitorOfT`1 v, Node n)
                at System.Data.Query.InternalTrees.BasicOpVisitorOfT`1.VisitNode(Node n)
                at System.Data.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n)
                at System.Data.Query.PlanCompiler.SubqueryTrackingVisitor.VisitRelOpDefault(RelOp op, Node n)
                at System.Data.Query.PlanCompiler.PreProcessor.Visit(FilterOp op, Node n)
                at System.Data.Query.InternalTrees.FilterOp.Accept[TResultType](BasicOpVisitorOfT`1 v, Node n)
                at System.Data.Query.InternalTrees.BasicOpVisitorOfT`1.VisitNode(Node n)
                at System.Data.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n)
                at System.Data.Query.InternalTrees.BasicOpVisitorOfNode.VisitDefault(Node n)
                at System.Data.Query.InternalTrees.BasicOpVisitorOfNode.VisitPhysicalOpDefault(PhysicalOp op, Node n)
                at System.Data.Query.InternalTrees.BasicOpVisitorOfT`1.Visit(PhysicalProjectOp op, Node n)
                at System.Data.Query.InternalTrees.PhysicalProjectOp.Accept[TResultType](BasicOpVisitorOfT`1 v, Node n)
                at System.Data.Query.InternalTrees.BasicOpVisitorOfT`1.VisitNode(Node n)
                at System.Data.Query.PlanCompiler.PreProcessor.Process(Dictionary`2& tvfResultKeys)
                at System.Data.Query.PlanCompiler.PreProcessor.Process(PlanCompiler planCompilerState, StructuredTypeInfo& typeInfo, Dictionary`2& tvfResultKeys)
                at System.Data.Query.PlanCompiler.PlanCompiler.Compile(List`1& providerCommands, ColumnMap& resultColumnMap, Int32& columnCount, Set`1& entitySets)
                at System.Data.EntityClient.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree)
            
      
     InnerException: 
    {"\r\nScheduleViewDataModel.msl(3,4) : error 3027: No mapping specified for the following EntitySet/AssociationSet - SqlAppointmentResources, SqlAppointments, SqlExceptionAppointments, SqlExceptionOccurrences, SqlExceptionResources, SqlResources, SqlResourceTypes."}
  4. Yana
    Admin
    Yana avatar
    4907 posts

    Posted 10 Sep 2013 Link to this post

    Hello Mark,

    I have tested again the uploaded project and it runs without a problem at our side. Please verify that the Telerik references in both the Silverlight and the Web project are from the same version and same location. Also we haven't changed the database schema from the previous version of the project..


    Regards,
    Yana
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  5. Alberto
    Alberto avatar
    5 posts
    Member since:
    Jun 2012

    Posted 13 Sep 2013 Link to this post

    Hi, Telerik Team.

    I downloaded the project and adjusted. In XP system with IIS 6 is working perfectly,  and save each regiter that I want when I press OK buttom. But now I want to publish the project in one server with Windows server 2008 with IIS7, and I have some issues. The project starts in Iexplorer but Time markers and category appears empty, I tried to add one register and it seems works but when I change the view to month view the register disappear, so never that register was in Data Base. In Iexplorer I got the next error.



    Mensaje: Unhandled Error in Silverlight Application Load operation failed for query 'GetSqlExceptionResourcesByRange'. El servidor remoto devolvió un error: NotFound.   en System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
       en System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error)
       en System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
       en System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )
    Línea: 1
    Carácter: 1
    Código: 0
    URI: http://192.9.200.50/mtto_DAMEX/ScheduleView_DB_CS.Web/ScheduleView_DB_CSTestPage.html

    Thanks in advacne
    Alberto C
  6. Yana
    Admin
    Yana avatar
    4907 posts

    Posted 18 Sep 2013 Link to this post

    Hello Alberto,

    I am not sure what is causing the issue at your side - it seems related to the database and the IIS7 setup. I would suggest to check here - the discussed issue is similar to the one that you've experienced.
    There are many other resources on the matter in the Internet as well.
     
    Regards,
    Yana
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  7. Adal
    Adal avatar
    1 posts
    Member since:
    Apr 2017

    Posted 17 Apr 2017 Link to this post

    It's a perfect example

    thanks

Back to Top