Reputation: 73
I'm trying to achieve having a custom name for C# Cache model column name created in ignite. currently the behavior is like below.
public class MeetingManager
{
[QuerySqlField]
public long MeetingId { get; set; }
[QuerySqlField]
public string MeetingName { get; set; }
}
var meetingCache = igniteClient.GetOrCreateCache<long, Meeting>(new CacheClientConfiguration
{
Name = typeof(Meeting).Name,
SqlSchema = "USERSCHEMA",
QueryEntities = new[] { new QueryEntity(typeof(long), typeof(Meeting)) }
});
with the above the to query the cache via sql.
i'm doing this select * from USERSCHEMA.MEETING WHERE MEETINGID=1
but i have to achieve something like below
select * from USERSCHEMA.MEETING_MANAGER WHERE MEETING_ID=1
basically i'm trying to have same for both RDBMS and ignite so that the same query can be executed here and there.
Upvotes: 0
Views: 236
Reputation: 2425
Won't QuerySqlFieldAttribute#Name
work here?
Alternatively, it's possible to create your schema manually:
QueryEntities = new[]
{
new QueryEntity
{
KeyTypeName = "Integer",
ValueTypeName = "java.lang.String",
TableName = "Table1",
Fields = new[]
{
new QueryField("length", typeof(int)),
new QueryField("name", typeof(string)) {IsKeyField = true, DefaultValue = "defName"},
new QueryField("location", typeof(string)) {NotNull = true},
},
Aliases = new [] {new QueryAlias("length", "len") },
....
Upvotes: 2