TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Andreas Mazatis
1.7k
33
754
Performance problems with SQLite and Linq Selection
Jan 14 2021 4:02 PM
I can not manage to select the data in a flat structure and detailed information in a array of the same structure together in one select.
If I do it one after the other, the performance is pretty bad.
Perhaps someone can help me, here is an extract from the structures, tables and the select statement.
Database
public
class
MovieDb
{
public
string
MovieGuid {
get
;
set
;}
public
string
Title {
get
;
set
;}
public
string
Plot {
get
;
set
;}
public
int
Time {
get
;
set
;}
public
string
Langu {
get
;
set
;}
public
int
FSK {
get
;
set
;}
...
}
public
class
ActorDb
{
public
string
ActorGuid {
get
;
set
;}
public
string
DisplayName {
get
;
set
;
public
string
Firstname {
get
;
set
;
public
string
Lastname {
get
;
set
;
...
}
public
class
ActorsInMovieDb
{
public
string
MovieGuid {
get
;
set
;}
public
string
ActorGuid {
get
;
set
;}
public
string
Role {
get
;
set
;}
}
public
class
ActorsInMovieDatabaseView
{
public
string
MovieGuid {
get
;
set
;}
public
string
ActorGuid {
get
;
set
;}
public
string
DisplayName {
get
;
set
;}
public
string
Role {
get
;
set
;}
}
View Classes
public
class
ActorItem
{
public
string
MovieGuid {
get
;
set
;}
public
string
ActorGuid {
get
;
set
;}
public
string
DisplayName {
get
;
set
;}
public
string
Role {
get
;
set
;}
}
public
class
MovieItem
{
public
string
MovieGuid {
get
;
set
;}
public
string
Title {
get
;
set
;}
public
string
Plot {
get
;
set
;}
public
int
Time {
get
;
set
;}
public
string
Langu {
get
;
set
;}
public
int
FSK {
get
;
set
;}
...
public
List<ActorItem> Actors {
get
;
set
;}
}
Select
foreach
(MovieMaster record
in
database.MovieDb)
{
movieItem =
new
MediaItem();
mediaItem = MappingMediaItem(record);
// --- Now, select the actors
movieItem.Actors = database.ActorsInMovieDatabaseView.AsNoTracking().Where(x => x.MovieGuid == record.MovieGuid).ToList();
// Select(a => new
// {
// DisplayName = a.DisplayName,
// Role = a.Role
// }
//).ToList();
}
Reply
Answers (
2
)
Mongodb Like qyery in linq C#
Develop a Linq query