Lightswitch 2013 - Show Connection Info - sql-server

I'm just about to deploy my first LS2013 app (Desktop only). I have a dev and live SQL Db (external DB's only), so the connection string changes depending on which server I want to connect to
I'd ideally like a way for the user to be able to choose dev or live that set the connection string. i don't think that's possible. Regardless of that, i'd like to be able to indicate somewhere (ideally menu bar, but if not in a splash screen) the name of the SQL server they are connected to.
Anyone know how to get some details of the current connection in C#?
Thanks
Mark

You need to write a simple WCF RIA Service that returns a simple DTO with the environment data that you want. On the server you have access to 'WebConfigurationManager.ConnectionStrings' and plenty other information. The MSDN docs on this are here:
Guidelines for creating WCF RIA Service for LightSwitch

The latest version of LightSwitch included in VS2013 update 2 has support to dynamically change the connection string based on the user or any other criteria that you choose like a web.config setting.
Unfortunately this information is still undocumented and the LightSwitch team will do a blog post about this in the near future, so keep a look out on the LightSwitch MSDN website. You could also search the LightSwitch MSDN forum for the post where this new capability was announced in recent weeks.

It's a bit of a kludge but you could have a table in each database called, say, Configuration, with a couple of columns: AttributeName and AttributeValue.
Your dev table could have a row with SQLServerName and DevBox1
Your live table would have SQLServerName and LiveBox1
Then you can just create a query to pull back the AttributeValue when AttributeName = "SQLServerName".

Related

Custom Authentication (Security Extension) with SSRS 2016

I am trying to implement custom forms authentication with SSRS 2016.
Within this article, a reference is made to the SQL Server Reporting Service Product Samples.
It appears that the latest supported version on the samples page (with regards to security extensions) is SSRS 2012. I have successfully applied the information gathered on the samples page to a SSRS 2014 instance. However, it looks as though the file system structure has changed a bit for SSRS 2016 (read, there is no longer a ReportManager folder) which seems to invalidate the instructions provided by the samples page.
Does anyone know where I can find updated procedures for establishing custom authentication?
We stumbled upon a thread on the MSDN forums located here. This thread has had quite a bit of activity including responses from the product team.
For anyone having issues with getting a custom security extension to work with SSRS 2016 in the next couple of weeks, please have a look. After that, it is my understanding that all of this information will be included in the documentation when the product is in a RTM state.
I recently did this work.
I searched in many sites. This example works for me:
https://github.com/Microsoft/Reporting-Services/tree/master/CustomSecuritySample.
Below, under the example of the project, there is a deployment manual.
Note, in my case, the web portal did not work without assigning machineKey in the files:
...\Reporting Services\ReportServer\web.config
...\Reporting Services\RSWebApp\Microsoft.Reporting­Services.Portal.WebHost.exe.config
In general, everything as described in the manual. Not missing a single step.
The site I used to generate the key:
http://www.developerfusion.com/tools/generatemachinekey/
I hope this info helps someone.
I think you dont have a problem with get username and password or generating user token, some changes about Security Extentions in SQL Server 2016 refers CheckAccess function in IAuthorizationExtension interface.
In the following links you can find changes and sample codes especially for implementing a Security Extension for SQL Server 2016.
Implementing a Security Extension
Configure Custom or Forms Authentication on the Report Server
Authorization in Reporting Services
IAuthorizationExtension.CheckAccess Method (String, IntPtr, Byte[], CatalogOperation)

How can I connect to my SQL Azure-database using Microsoft Silverlight?

I have a database online at Windows Azure. I want to connect to the database and show some tables in Microsoft Silverlight. I have created a Silverlight Application and published the website on Azure here!
How do I connect to my SQL Azure database in Silverlight?
The same way as connecting to any other database!
Personally, I use EntityFramework and create my own service. You can use EF and use RIA Services to create a lot of code for you though if you prefer.
Add an Entity Model to your project, create from existing db, point at your Azure Db, job done. Remember to add your existing IP to the Azure firewall while developing.
EDIT:
Try following this tutorial instead:
http://msdn.microsoft.com/en-us/library/ee707376(v=vs.91).aspx
BUT one thing to watch out for. When you come to the step to add a DomainService, if it hasn't picked up your context you will need to follow the steps listed here:
http://support.microsoft.com/kb/2745294
... which are easy to follow. Delete the TT files and change the model code generation strategy from none to default.
One thing that you can do is create a WCF project, which will act as your Web Role in Azure.
Ideally, you may have 2-3 projects in your solution:
1) Silverlight Project (Presentation Layer)
2) WCF Project (Business Layer)
3) C# Class Project for your Sql Connections (Data Layer)
What you would be able to do is use C# .Net libraries for Sql to connect to your database. You may either execute stored procedures (Can pass in variables), which are cached in memory for faster long-term performance, or Sql queries in a string variable, to pull the exact information you want in custom queries. This would be returned to the WCF Project in which you would be able to perform any custom business-logic and you may begin to package your data into class objects. These objects may be passed back to Silverlight via a Service Reference, and you may use many familiar Silverlight tools to display your information.
The above recommendation may be a more more in-depth than that of the other recommendations, but in cases where you really need control over your data and need to apply business logic, this is a good way.
The easiest way in the world I know of to hook up a SQL Database to a Silverlight application is to use a Visual Studio LightSwitch project. There are ton's of posts on how to do this - http://blogs.msdn.com/b/lightswitch/ . Basically if you make a LightSwitch application (available in VS Professional SKUs and up), it gives you several screen templates to choose from which are all Silverlight (or HTML 5 if you choose). Then you can "attach" to an existing SQL Database such as SQL Azure just fine. And make browse or edit screens around the SQL data.
You can optionally model your own SQL Database and then "publish" it out to SQL Azure.
You can do all of this without writing any code too and provides some good basic functionality.
HTH - Matt

Sync Offline Database with External Database Windows Phone 7

I have a wp7 app that uses the local database implemented with linq. I have an external MS-SQL (2008 R2) server. Both databases have the same schema.
I would like to know how to do the following:
Download information from the MS-SQL to the Database into the local DB of the phone. (Can I use some data-binding technique - I have found no links that do this)
If Changes made on the phone (add new record, edit existing record) how can I push changes back to server.
If changes are made to server then push to phone (I know I can use an observer pattern here)
I should also note that the client app is not used always-on access to the internet.
Thanks
There's no magic here.
You will need to create functionality to get updates from the server (probably meaning you need some kind of timestamp on each record, saying when it was last changed so you can query it).
You will need to create the functionality to upload data and update the database on the server (and potentially handle conflicts).
I would either use ODATA to communicate with the server, or plain old WCF/JSON service.
have a look at the Sync Framework Toolkit

Sql Server 2008 Reporting Services email on the fly solution

To all,
I have noticed that other reporting tools allow you the option, at the time of running a report from the web interface, to either have it rendered to the browser or allow you to enter an email address have have the report sent to that address. This would be helpful for long running reports or reports that are fairly large.
My question is whether this can be done with the existing sql server 2008 report server toolset or if there are third part solutions available?
Thanks.
--sean
I don't think that what you are wanting to do is possible out of the box.
This may seem like overkill for your situation, however, I have worked for a client who wanted some custom features like this. Given that Report Manager is so inflexible out of the box, we wrote a new front end leveraging the Reporting Services Service. We could then write our own extended capabilities right into the new viewer.
This link describes it a bit more.
http://msdn.microsoft.com/en-us/library/ms159218.aspx
You can setup a subscription on a report which will email it too you once or at regular intervals.
This Link give you more info. Be aware that if you want data driven subscriptions you need enterprise sql server.

Where can I find resources for setting up a Silverlight app that accesses sql server 2008 Express DB?

I am trying to set up a basic Silverlight application to run behind the firewall on my Windows XP machine with IIS 5.1. We have a MySQL server for production purposes, but I would like to set up SQL Server 2008 Express Edition on my Windows XP machine to host the database part of the application.
I'm completely new to a lot of .NET develoment but would like to find the resources to get started. I've checked out Silverlight.net/GetStarted/, but unless I missed something there, this step wasn't explicitly there.
Does anyone know where I could go to read about how to do this and maybe a simple walthrough of a sample Silverlight application written to access SQL Server 2008 Express?
Any suggestions and links would be much appreciated.
There are 3 options that I know of for connecting to a database from Silverlight:
WCF: Create your own WCF service with methods like GetCustomers(), UpdateCustomers() and DeleteCustomers(). Those methods are implemented on the server side, so in the background you can use LINQ to SQL or just open an old-fashioned SqlConection and run some SqlCommands against the database.
ADO.NET Data Services: This is a custom WCF service implemented by MS. You point the service at an Entity Framework class (auto generated from your custom database, super easy to create) and in turn it'll accept standard http rest commands that that do things like GetCustomers/Update/Delete. You can then add a service reference to this guy from your Silverlight app and it will auto generate 1 class per table, etc along with a client to connect to the server (http port 80 so no firewall concerns here). On the client side you're interacting with rich classes that look just like your database structure and work well with LINQ. This is not Silverlight specific and could be used from any client, even a console app.
.NET RIA Services: This is like ADO.NET Data Services but adds support for many things Silverlight including property change notification on the client side (note that the bleeding edge CTP2 of ADO.NET Data Services also implements change notifications), easy to hook events for browser navigation (i.e. you get an event when the user clicks back or forward) and code sharing between the server and the client (just name your file MyClass.shared.cs in your ASP.NET application and it magically shows up in your Silverlight client).
All of these options use http port 80 so they'll work well with your firewall. I'd really encourage you to try all 3 if you've got the time. If you don't have the time go directly to ADO.NET Data Services (grab the CTP2 you'll appreciate the new features).
Plain vanilla SL + WCF + SQL, but it's a little old:
http://msdn.microsoft.com/en-us/magazine/cc794260.aspx
Shawn Wildermuth's MSDN article is a good starting point for ADO.NET Data Services:
http://msdn.microsoft.com/en-us/magazine/dvdarchive/cc794279.aspx
This will get you up and running with good results in short time but note that it uses beta software. You'll see how many improvements have been made to ADO.NET DS since Shawn wrote that previous article:
http://blogs.msdn.com/astoriateam/archive/2009/09/01/introduction-to-data-binding-in-ctp2.aspx
And here's Brad Abram's mother of all data connectivity posts (RIA Services focus here - I think the series is up to 24 parts now):
http://blogs.msdn.com/brada/archive/2009/08/02/business-apps-example-for-silverlight-3-rtm-and-net-ria-services-july-update-summary.aspx

Resources