This question is locked. New answers and comments are not allowed.
Ihave simple contract
[EnableClientAccess]
[DataContract]
public
class
LogEvent
{
[Key]
[DataMember]
public
virtual
int
EventId {
get
;
set
; }
[DataMember]
public
virtual
string
Source {
get
;
set
; }
[DataMember]
public
virtual
DateTime Timestamp {
get
;
set
; }
[DataMember]
public
virtual
byte
? EventTypeId {
get
;
set
; }
//SeverityId
[DataMember]
public
virtual
int
? UserId {
get
;
set
; }
[DataMember]
public
virtual
string
Message {
get
;
set
; }
}
DDL (MS SQL 2008):
CREATE
TABLE
[dbo].[System.Log](
[EventId] [
int
] IDENTITY(1,1)
NOT
NULL
,
[Source] [nvarchar](80)
NULL
,
[
Timestamp
] [datetime]
NOT
NULL
,
[EventTypeId] [tinyint]
NOT
NULL
,
[ActivityTypeId] [tinyint]
NULL
,
[UserId] [
smallint
]
NULL
,
[Message] [nvarchar](4000)
NOT
NULL
,
CONSTRAINT
[PK_System.Log]
PRIMARY
KEY
CLUSTERED
(
[EventId]
ASC
)
WITH
(PAD_INDEX =
OFF
, STATISTICS_NORECOMPUTE =
OFF
, IGNORE_DUP_KEY =
OFF
, ALLOW_ROW_LOCKS =
ON
, ALLOW_PAGE_LOCKS =
ON
)
ON
[
PRIMARY
]
)
ON
[
PRIMARY
]
& fluent configuration
protected
override
IList<MappingConfiguration> PrepareMapping()
{
List<MappingConfiguration> configurations =
new
List<MappingConfiguration>();
//preparedConfigs
var logEventMapping =
new
MappingConfiguration<LogEvent>();
logEventMapping.MapType(logEvent =>
new
{
EventId = logEvent.EventId,
EventTypeId = logEvent.EventTypeId,
Message = logEvent.Message,
Source = logEvent.Source,
Timestamp = logEvent.Timestamp,
UserId = logEvent.UserId
}).ToTable(
"System.Log"
);
//<<<Problem here
logEventMapping.HasProperty(logEvent => logEvent.EventId).IsIdentity(KeyGenerator.Autoinc);
configurations.Add(logEventMapping);
return
configurations;
}
When I'm trying to get entities:
var db = new FluentModelContext();
var events = db.GetAll<LogEvent>();
exception thrown (on populating)
{"Error executing query: Telerik.OpenAccess.RT.sql.SQLException: Invalid object name \"Log\".\r\n at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeQuery()\r\n at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeQuery()\r\n at OpenAccessRuntime.Relational.fetch.FetchResultImp.Execute()\nSQL:\nSELECT a.[EventId] AS COL1, a.[EventTypeId] AS COL2, a.[Message] AS COL3, a.[Source] AS COL4, a.[Timestamp] AS COL5, a.[UserId] AS COL6 FROM [Log] a ORDER BY COL1 Telerik.OpenAccess.RT.sql.SQLException: Недопустимое имя объекта \"Log\".\r\n at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeQuery()\r\n at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeQuery()\r\n at OpenAccessRuntime.Relational.fetch.FetchResultImp.Execute()"} Telerik.OpenAccess.OpenAccessException {Telerik.OpenAccess.Exceptions.DataStoreException}
I've tried "[System.Log]", "'System.Log'", "'dbo'.'System.Log'", "[dbo].[System.Log]",
but nothing worked for me (similar exception - Invalid object name "log_event"... or something related to base LogEvent class (but there is no base class!)
)
Changing table name to "Log" - works, but I need this prefix.