This project is read-only.

“No default type for sort ...” exception

Feb 22, 2009 at 7:42 PM

Hi,

I am trying to create one product of two models (2 different assemblies).

In model_1  I have the following ‘User’ class:
public class User : LabeledInstance<User>

Which has the action:

[Action]
public static void AddUser([Domain("new")] User usr)
{
     AllUsers = AllUsers.Add(usr);
}

In the model_2 I want to use ‘User’ as an argument to actions:

[Action]
public static void AddUser(User usr)
{
     // Do something
}

or

[Action]
static void Setup([Domain("allUsers")] User usr)
{
     // Do something
}

* For the above action I create a local method:
// Returns the allUsers from User
internal static Set<User> allOppUsers()
{
    return User.AllUsers;
}

In the MPV commandline I have:

/r:Model_1.dll
/r:Model_2.dll
/mp: Model_1
/mp: Model_2

When I am trying to execute MPV I always get the “No default type for sort User” exception.
I have managed to find out that I get this exception when I am using ‘User’ in model_2 as a parameter to an action.

I would appreciate it if you could explain me what I am doing wrong here. How can I create a product from 2 different models?

Thank you,
Ofer

Feb 25, 2009 at 11:09 AM

Hi,

I have managed to find what I think, is the cause of this issue in the NModel source.
I did few code changes which fixed my problem.

I will try to create a new-item in the issue-tracker and upload my code changes there.

Since these code-changes touch the NModel internals, I would appreciate it if you could check it and make sure that it doesn't hurt the NModel intended design or functionality.

Thank you,
Ofer

Feb 25, 2009 at 11:21 AM
A new work-item with the attached code was created: Finding Type of sort in a models' composition

Ofer