Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of SQL Azure 2012 Connection string #430

Closed
GoogleCodeExporter opened this issue Jul 30, 2015 · 2 comments
Closed

Support of SQL Azure 2012 Connection string #430

GoogleCodeExporter opened this issue Jul 30, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?

1. I have used the 'IsConnectionStringAzure' to use the cloud configuration 
file instead of web.config
2. I have also added the required configuration to the cloud configuration file 
for connecting string as mentioned on 
http://community.codesmithtools.com/nettiers/f/16/p/10124/37948.aspx#37948 


What is the expected output? What do you see instead?

I was expecting that the solution will read the connection string from cloud 
configuration file and solution works fine with it.

But instead i get "Object reference not set to an instance of an object" error 
on the line 


settings.ConnectionString = 
RoleManager.GetConfigurationSetting("netTiersConnectionString");

under datarepository.cs file. 
in debug i found RoleManager.IsRoleManagerRunning = false.  seems role manager 
has not started. I did not find any code to instantiate RoleManager in the file


What version of .netTiers and CodeSmith are you using?

I am using CodeSmith Generator Professional 6.5.2 Revisoin 14758
and .netTiers v2.3.1


Please provide any additional information below.

While investigating i have realized that the netTiers Azure consideration is 
for the old version of AZURE 2009 but on my machine i have AZURE OCT-2012 
version. So, i have decided to update the template.

I have done following modification to the template to make it working with 
AZURE OCT 2012 version. Just logging here to track it as i have been advised in 
my post on community forum 
http://community.codesmithtools.com/nettiers/f/16/p/12857/49935.aspx#49935



Following is what i did..


The issue was not able to load the RoleManager. But in my other Windows Azure 
project i am not using the 'Microsoft.ServiceHosting.ServiceRuntime' and 
instead i am using Microsoft.WindowsAzure.Configuration. Might be because I am 
using latest version of Azure SDK from Oct-2012. So, i have decided to change 
the template. Following changes i have done in the template.



Change 1

I have copied the Microsoft.WindowsAzure.Configuration.dll from "C:\Program 
Files\Microsoft SDKs\Windows Azure\.NET SDK\2012-10\ref\" to the reference 
folder of the framework



Change 2

In netTiers.cst i have changed following


if(IsConnectionStringAzure)

{

//SafeCopyFile(this.CodeTemplateInfo.DirectoryName + 
"\\References\\AzureSDKv1_0\\Microsoft.ServiceHosting.ServiceRuntime.dll", 
libPath + "\\Microsoft.ServiceHosting.ServiceRuntime.dll");

            SafeCopyFile(this.CodeTemplateInfo.DirectoryName + "\\References\\AzureSDKv1_0_200911\\Microsoft.WindowsAzure.Configuration.dll", libPath + "\\Microsoft.WindowsAzure.Configuration.dll");

}



Change 3


In DataRepository.cst i have changed following


<% if ( IsConnectionStringAzure ) { %>

//using Microsoft.ServiceHosting.ServiceRuntime;

using Microsoft.WindowsAzure;

<% } %>



And following


<% if ( IsConnectionStringAzure ) { %>

ConnectionStringSettingsCollection connectionStrings = new 
ConnectionStringSettingsCollection();


ConnectionStringSettings settings = new ConnectionStringSettings();

//settings.Name = "netTiersConnectionString";

//settings.ConnectionString = 
RoleManager.GetConfigurationSetting("netTiersConnectionString");


                    settings.Name = "<%=DALNameSpace%>.ConnectionString";

                    settings.ConnectionString = CloudConfigurationManager.GetSetting("<%=DALNameSpace%>.ConnectionString");



connectionStrings.Add(settings);


return connectionStrings;

<% } else { %>



Change 4


In cloud webrole's serviceconfiguration.cscfg file instead of 
netTiersConnectionString I have used same config name from my web.config (just 
got the feeling that it should match as mentioned in the provider details on 
web.config -- Sorry for my poor .net knowledge)



After above i have re-generated the solution and tested it working fine. 


I am also attaching the changed files. 


Original issue reported on code.google.com by pateljig...@gmail.com on 7 Dec 2012 at 10:46

Attachments:

@GoogleCodeExporter
Copy link
Author

Original comment by bniemyjski on 7 Dec 2012 at 1:12

  • Changed state: Investigating
  • Added labels: Type-Patch
  • Removed labels: Type-Defect

@stale
Copy link

stale bot commented Jun 2, 2020

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues. This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 2, 2020
@stale stale bot closed this as completed Jun 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant