Sending abstract class with DomainService WCF service to Silverlight - silverlight

I was using a simple WCF service with silverlight but I wanted to validate data with annotations and I didn't want to write a whole new layer in silverlight project. So I decided to switch to using a DomainService, created through generating code in the silverlight project.
Now comes the trouble. I have a parent class and about 10 derived classes. Through WCF, I was able to just use the base class. Now I am trying to use a DomainService with the base class decorated with the KnownType attribute. The problem is now those attributes get replicated in silverlight client and a compilation error is thrown. Anybody know how to use DomainService with inheritance? I want to deliver only the information from the base class.

I don't completely follow what your problem is, but this is a great tutorial on how to use Domain Services in Silverlight, and the example includes an abstract base class for all entities, similar to what I think you're doing.

Related

ApplicationModule definition class code is blank in ADF

When i select Generate Application Module class and click OK, The AMImpl.java class is generated without any code. what might be the reason for this?
It's because all the code is in the base class.
What do you expect to be in the class?
When you define to create the class, you can choose what will be created (all based on the time you create the class).
Then all methods you write will end up in this class and can be exposed to the client.
Use is described here.
Per the docs:
The base classes of the ADF Business Components framework may be
extended to incorporate custom code with all types of components in
the framework and to extend the ADF Business Components framework
behavior.
When used without customization, your business component is completely defined by its XML document and it will be fully functional
without custom Java code or even a Java class file for the component.
If you have no need to extend the built-in functionality of a
component in ADF Business Components, and no need to write any custom
code to handle its built-in events, you can use the component in this
XML-only fashion. However, when you do extend base classes of the ADF
Business Components framework, you can still work with XML documents
in JDeveloper.
Once you have created framework extension classes, any new business component you create can be based on your customized
framework class instead of the base one. And, you can always update
the definitions of existing components to use the new framework
extension class as well.
Best practice is to create your own set of custom framework extension classes so you have hook points for creating common code for your custom ADF BC EOs and VOs

Design decision to migrate Silverlight application

I have a silverlight application, it has pretty complex UI. In some forms I am using MVVM pattern. However there are many forms where code behind file has most of the form logic code (no view model).
Silverlight application is having both business and UI logic. There is a WCF service which SL application is directly calling. This WCF service is a data service (DB logic).
I want to migrate silverlight application into HTML5. I have following questions.
There are many links to migrate the SL application to HTML5 (even using MVVM pattern). Many suggests to use some JS framework library like AngularJS/Knockout. Can you please tell me which one works best for migration from SL?
Where would I put the business logic? Can I write my business logic using JS library? Also in case I write business logic using some library then won't it expose all my logic to client?
In case JS library is not the right thing to write the business logic then what other technology I should use? WebAPI or something else?
Atul Sureka
For Server Side Code Reusablity (MVVM) Code use AngularJS/KendoUI
Use C# Object to JavaScript Object Convrsion
Server Side Logic we can Re-Use, Client Side Logic C# to Java Script
User Rest API's

WPF WCF Entity Framework Can not view Classes in WPF project

I am wprking on a project and I have 2 projects in one solution. I added my WCF project and inside it I added an entity framework. Also in Service1.svc I can reach the classes and use them for saving like
public bool saveuser(User user)
{
}
For example User is the name of my database and Its pretty fine working in WCF part but at WPF part Im trying to access this class again to fill this class's object and I using MyClass.ServiceReference1; on the top and Inside one of my method I can not reach this class. What should be the solution why I can not access my class instead I added this WCF service as a service reference and enabled async operations.
Im newbie and thanks
Sincerely

My class not shown in xaml so that can be added as resource in SilverLight

I have created a class so that I can bind it to a combo box. I have a solution where there are two projects test and test.web. In the test.web I have added a new class so that I can bind it to a combobox. In the same test.web I have created few entities with help of ADO.net Entity Object Generator and those classes can be seen when I am trying to add my class as resource to a grid. Why not my class?
When I add my class as resource I get error the type '..' was not found. Verify that you are not missing assembly reference....
Finally I found the answer. My understanding of SilverLight was wrong as I am still learning it. I found out that I cannot directly access all the class in the model on the client side directly. They all should be exposed using DomainService and DomainService is the thing which you can access on the client side, if you have to access your class expose that through DomainService.

Ria Service Generated Code Not Accessible in Silverlight Code

I have the following Ria Service define:
namespace SilverlightTest.Web
{
[EnableClientAccess()]
public class ContactService : LinqToEntitiesDomainService<AdventureWorksEntities>
{
public IQueryable<Contact> GetContactSearch(string lastName)
{
ContactRepository rep = new ContactRepository();
return rep.SearchByLastName(lastName);
}
}
}
When I compile the solution, my SilverlightTest project does create the SilverlightTest.Web.g.cs file and the appropriate Context objects are created when I look at it. However, when I attempt to import the SilverlightTest.Web namespace to access the Data Context class for the above service, it says it cannot find the Web namespace.
The only difference I can see between what I'm doing and many examples that are out there on the web is that my AdventureWorksEntities data context is located in a separate business object dll. I tried to query the context directly instead of using the Repository Pattern I'm attempting to do and it also isn't work working.
Any ideas? Is it possible to have Ria Services access a separate DLL handling data access or does it HAVE to be in the same project?
I've been able to put the Ria service in a separate project before, although I do remember having issues. Not sure exactly what it was, but I would check two things: your references and your web.config (in the hosting website). When you add a ria service to a web project it does some things behind the scenes that wire everything up correctly.
Could try adding a service to your web project temporarily and see what it adds.
It seems that Resharper does not recognize the .gs files and their name spaces. If you disable R# or just code without intelisense it works.

Resources