Hi there!
I have a table with only two uniqueidentifier-colums. It's the UserInRoles-table.
My mapping is the following:
The definition of the class and the id:
public class ProChristFluentUserInRoleIdentity : IObjectId
{
public Guid UserId { get; set; }
public Guid RoleId { get; set; }
public ProChristFluentUserInRoleIdentity()
{
UserId = Guid.NewGuid();
RoleId = Guid.NewGuid();
}
public ProChristFluentUserInRoleIdentity(string s)
{
UserId = Guid.NewGuid();
RoleId = Guid.NewGuid();
var parts = s.Split('*');
Guid tUserId;
if (Guid.TryParse(parts[0], out tUserId))
{
UserId = tUserId;
}
Guid tRoleId;
if (Guid.TryParse(parts[1], out tRoleId))
{
RoleId = tRoleId;
}
}
public override bool Equals(object o)
{
if (this == o) return true;
if (!(o is ProChristFluentUserInRoleIdentity)) return false;
var id = (ProChristFluentUserInRoleIdentity)o;
if (UserId != id.UserId) return false;
if (RoleId != id.RoleId) return false;
return true;
}
public override int GetHashCode()
{
var result = 0;
if (UserId != Guid.Empty)
result += UserId.GetHashCode();
if (RoleId != Guid.Empty)
result += RoleId.GetHashCode();
return result;
}
public override string ToString()
{
var buffer = new System.Text.StringBuilder();
buffer.Append(UserId).Append('*');
buffer.Append(RoleId);
return buffer.ToString();
}
}
[Persistent(Identity = typeof(ProChristFluentUserInRoleIdentity))]
public class ProChristFluentUserInRole
{
/// <summary>
/// Gets or sets the user-Id.
/// </summary>
/// <value>
/// The user-Id.
/// </value>
public Guid UserId { get; set; }
/// <summary>
/// Gets or sets the role-Id.
/// </summary>
/// <value>
/// The role-Id.
/// </value>
public Guid RoleId { get; set; }
}
But, when I try to make a request, I get the following error:
[DataStoreException: Count(*) query failed: Telerik.OpenAccess.RT.sql.SQLException: Invalid column name 'ProChristUsersInRoles_id'.
Statement(s) could not be prepared.
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeQuery()
at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeQuery()
at OpenAccessRuntime.Relational.RelationalStorageManager.executeCount(RelationalCompiledQuery cq, QueryParameters parameters)
SELECT COUNT(1) FROM ( SELECT a.[ProChristUsersInRoles_id] AS COL1, a.[RoleId] AS COL2, a.[UserId] AS COL3 FROM [ProChristUsersInRoles] a WHERE a.[UserId] = ? AND a.[RoleId] = ? ) AS TMP_COUNT
That is right, because there's no column with name: ProChristUsersInRoles_id
I've tried different KeyGenerator-Types, but without any luck.
I don't know how to solve this problem. Can you help me, please?
Thanks in advance, Dieter