Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make RIA ignore a property when generating entities?

Background: Silverlight 4 ("Library" silverlight project) RIA connected to Entity Framework Model (Library.Web web application project).

Description:

I have a class:

public class Book
{
    [Key]
    public int ID { get; set; }
    public String Name { get; set; }
    public DateTime DatePublished { get; set; }

    // I don't need this one in SL4
    public BookInfo Info { get; set; }
}

When I try to compile, RIA generates the following error:

Entity 'MyCompany.Library.Book' has a property 'Info' with an unsupported type.

Question: I don't need that property in SL4 application so what I want to know is how to prevent the RIA from trying to generate that property when generating the proxy object?

like image 339
Kornelije Petak Avatar asked Nov 29 '25 23:11

Kornelije Petak


1 Answers

public class Book
{
    [Key]
    public int ID { get; set; }
    public String Name { get; set; }
    public DateTime DatePublished { get; set; }

    // I don't need this one in SL4
    [Exclude]
    public BookInfo Info { get; set; }
}

Using the Attribute [Exclude] ria wont pass that property to the client side and it will only be visible on the server side i think this is what you are looking for :D

like image 182
Goblin Avatar answered Dec 01 '25 11:12

Goblin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!