Print Page | Close Window

EntityServiceApplication & OnServiceStartup

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1500
Printed Date: 19-Apr-2025 at 7:39am


Topic: EntityServiceApplication & OnServiceStartup
Posted By: antalakas
Subject: EntityServiceApplication & OnServiceStartup
Date Posted: 30-Sep-2009 at 2:14am
Hello,

I create a silverlight application using the devfore template. Nothing unusual.

Then i create a new assembly, namely Server.dll and add a reference to it in the web project. An entry in web.config <probeAssemblyName name="Server" /> is also added.

I add a method in Server.dll tagged with the [IdeaBlade.EntityModel.AllowRpcAttribute].

Then, from the client i use InvokeServerMethodAsync to access this method and everything works great.

At last, i create a new class, MyServiceApplication :


using System;
using System.Linq;

using IdeaBlade.EntityModel;
using IdeaBlade.Core;

namespace Server
{
    public class MyServiceApplication : IdeaBlade.EntityModel.EntityServiceApplication
    {
        public override void OnServiceStartup(object sender, ServiceStartupEventArgs e)
        {
            TraceFns.WriteLine("MyServiceApplication - OnServiceStartup");
            base.OnServiceStartup(sender, e);
        }

        public override void OnServiceShutdown(object sender, EventArgs e)
        {
            TraceFns.WriteLine("MyServiceApplication - OnServiceShutdown");
            base.OnServiceShutdown(sender, e);
        }
    }
}

I expect, when the Entity Service is created, to call OnServiceStartup and write an entry in DebugLog.xml. In DebugLog.xml i receive:

IdeaBlade.EntityModel EntityServiceApplication::OnServiceStartup EntityService created ,

which means that no override took place.

Do i miss something?

Thank you

Andreas

-------------
Andreas Ntalakas



Replies:
Posted By: kimj
Date Posted: 30-Sep-2009 at 9:36am

DevForce uses somewhat different means of looking for the methods marked with the AllowRpcAttribute vs. an implementation of a custom EntityServiceApplication.

Methods marked with AllowRpc aren't actually probed - the type and method information provided in the InvokeServerMethod call is used to search for the method.  The assembly is loaded if necessary, but it's assumed to already be in the bin folder.  If you add the assembly name to the <probeAssemblyNames> somewhere in the config this will usually just mean that the assembly has already been loaded (usually when probing for other reasons) before the type and method are reflected.
 
Probing is used when looking for a custom EntityServiceApplication.  Here only the top-level (as opposed to EdmKey-level) <probeAssemblyNames> are searched.  So your implementation should be found if you add (or move) that <probeAssemblyName> element to the top-level.  (You can use the Configuration Editor if you need help with the elements/attributes defined in the ideablade.configuration section.)



Print Page | Close Window