This is a migrated thread and some comments may be shown as answers.

Speed issues after upgrade

3 Answers 64 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jonah
Top achievements
Rank 1
Jonah asked on 20 Aug 2015, 03:33 PM

I upgraded my Rlinq to a fluent model. Since I have, I am noticing a pretty sharp performance decline.

This is the link I used to upgrade my project http://www.telerik.com/blogs/benefits-of-code-only-mapping-and-how-to-get-them

Has anyone else had any issues? Or are there any known issues?

3 Answers, 1 is accepted

Sort by
0
Jonah
Top achievements
Rank 1
answered on 20 Aug 2015, 08:17 PM

So I thought I would post here just in case anyone else ran into this issue. The slowdown comes from the context calling the PrepareMapping method each time the context is called. If you update your context that was auto created for you which looks like

private static string connectionStringName = @"FCMWebConnection";
private static BackendConfiguration backend = GetBackendConfiguration();
private static MetadataSource metadataSource = new WebServerFluentMetadataSource();
public WebServer()
:base(connectionStringName, backend, metadataSource)
{ }

public WebServer(string connection)
:base(connection, backend, metadataSource)
{ }

public WebServer(BackendConfiguration backendConfiguration)
:base(connectionStringName, backendConfiguration, metadataSource)
{ }

public WebServer(string connection, MetadataSource metadataSource)
:base(connection, backend, metadataSource)
{ }

public WebServer(string connection, BackendConfiguration backendConfiguration, MetadataSource metadataSource)
:base(connection, backendConfiguration, metadataSource)
{ }

 

And change it to

private static string connectionStringName = @"FCMWebConnection";
static MetadataContainer metadataContainer = new WebServerFluentMetadataSource().GetModel();
static BackendConfiguration backendConfiguration = new BackendConfiguration()
{
Backend = "mssql"
};
public WebServer()
: base(connectionStringName, backendConfiguration, metadataContainer)
{
}

0
Kaloyan Nikolov
Telerik team
answered on 21 Aug 2015, 10:45 AM
Hello Jonah,

I can confirm that your observations are correct. The reason why the default implementation is creating the model each time is that fluent model is dynamic by its nature and in your code could create different mapping based on some conditions. That's why it is up to you to decide how to optimize it. 

Regards,
Kaloyan Nikolov
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
0
Dan Avni
Top achievements
Rank 1
answered on 17 Jan 2018, 07:24 AM
Thank you for the solution! I just upgraded to the fluent model and was banging my head why the the PrepareMapping called so many times... I guess sometimes using something as late as I did lets others solve the problems first ;-) 
Tags
Data Access Free Edition
Asked by
Jonah
Top achievements
Rank 1
Answers by
Jonah
Top achievements
Rank 1
Kaloyan Nikolov
Telerik team
Dan Avni
Top achievements
Rank 1
Share this question
or