Question

Here is my problem.

I have a Factory class, decorated with DataObject and a Systems method, decorated with Select. It has a parameter which is an enum ive created, so it reads like:

namespace BLL {

[DataObject]
public class Factory {


    [DataObjectMethod(DataObjectMethodType.Select)]
    public List<WaterSystem> Systems(PermissionLevel permission) {

        ...
    }
}

}

My problem is that whenever i try to use this method with the Obbjectdatasource wizard is just crashes...actually, it doesnt do anything. Am able to pick my BusinessObject, Factory and it doesnt do anything else, it disappears when i was supposed to pick the select method.

Ive tested and it only happen when the parameter is an enum. What can i do?

My general idea is that the Enum will represent visibility levels i want to give to the data being fetched, so i need it or something replaceable.

Was it helpful?

Solution

Sergio, I had to deal with this situation today and I was able to successfully configure the enum value declaratively inside the <SelectParameters> collection:

<asp:Parameter Name="permission" Type="Object" DefaultValue="ReadOnly" />

What seems to matter is that the enumeration value that is mentioned in the DefaultValue attribute is a textual-representation of the enum key. In case this value has to be assigned dynamically you can use <asp:ControlParameter /> with almost the same attributes.

Note: the "ReadOnly" value here is per my assumption regarding the implementation of your PermissionLevel enumeration type.

public enum PermissionLevel { ReadOnly, Modify }

OTHER TIPS

Well, as it turns out, i just dont have to rely on the wizard to do it. I ended up doing it manually. Ive only specified the parameter name on the objectdatasource and on the selecting event ive set the parameter.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top