Using a WCF Service to create a Linked Table in MS Access - wcf

<Updated>
I wrote a WCF Service based on netTcpBinding that get its data from SQL Server, Is there any way to consume these data in MS Access?
In the other word I want to create a read-only Linked Table using this service, in MS Access
Linked Table means me a table that get its data from an external source(in my case from WCF Service).
<Updated/>
My service has a method:
public IEnumerable<Person> GetPeople()
that Person is:
public class Person
{
public int {get;set;}
public FirstName {get;set;}
public LastName {get;set;}
}
I want to have a read-only Linked Table in MS Access, with above data(data that return from GetPeople()), I want to join the Linked Table with my other tables to create a new Query.

Related

How to automatically transfer data from Cosmos DB to Azure SQL database?

I would like to sample relevant data from Cosmos DB documents every time Cosmos DB receives a new document, and send it automatically to Azure SQL Database.
The whole purpose is to create a live Power BI report that gets updated with the newest data that comes in to Cosmos DB, but since I don't need to show everything, I made a SQL Database in Azure and I am only missing how to make an Azure function that is triggered when Cosmos DB receives a new document. Also that the function needs to get the relevant data and sends it to Azure SQL.
Is there a standard way to do this?
Do I have to make an Azure Function App?
I am very new to both coding and Azure, so I appreciate if someone can help using a beginner language.
However, any help is appreciated.
You can easily do that with an Azure Function that uses the CosmosDB Trigger.
The trigger will be, well, triggered whenever there is one of more changes or and additions in the CosmosDB collection that you are targeting. Then simply add your own code for SQL insertion.
namespace CosmosDBSamplesV2
{
public static class CosmosTrigger
{
[FunctionName("CosmosTrigger")]
public static void Run([CosmosDBTrigger(
databaseName: "CosmosDBName",
collectionName: "CosmosColName",
ConnectionStringSetting = "CosmosDBConnection",
LeaseCollectionName = "leases",
CreateLeaseCollectionIfNotExists = true)]IReadOnlyList<Document> documents,
ILogger log)
{
if (documents != null && documents.Count > 0)
{
//do SQL insert with your code here
}
}
}
}
You can read how you can connect to a SQL db from an azure function here: https://learn.microsoft.com/en-us/azure/azure-functions/functions-scenario-database-table-cleanup
You can read more about CosmosDB related azure functions here: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-cosmosdb-v2

Entity Framework 6 with Azure DB secondary connection

I'm facing a problem with EF against Azure DB secondary connection. Here is my problem:
I'm using EF 6 with code first
I already setup a primary Azure DB with 2 Active GEO-Replicated secondary database (have difference server and db name as well as login account)
I use EF6 to manipulate the primary Azure DB. The case is that if the primary DB is down (by any reason) and I want to switch to the active secondary dbs for select statements at runtime. How can I achieved that?
Notes: For example, I have the code snippet below:
using (AppContext context = new AppContext()) // AppContext is derived from DbContext and using the primary connection string
{
var users = await context.Users.ToListAsync(); // If this line of code failed with the primary connection string
}
I want to auto-switch dynamically to the secondary db if the line var users... is failed at runtime. Any recommendation?
Thanks for your help!

SSIS OLE DB Connection Select Statement Cross Server Queries

I have access to a database that contains a lot of information, and I only import data from one of it's tables into my database where the GUID field of the rows in my one database table matches the GUIDs in one of theirs.
Now in my Data Flow Task, I have an OLE DB Source whereby I want to set the data access mode to a SQL Statement whereby I select all the records where TheirGuid = MyGuid.
The problem I face is that my database and their database are on two different servers; is there any way to achieve this without creating linked servers (whereby they will have access to query my database which is essentially not what I want).
Here is a sample of my table (In Database A, located on Server A):
Index Number
Name
Surname
Special GUID
Status
Their table would look like this (In Database B, located on Server B):
Source ID
Special GUID
etc...
You will be doing something along these lines:
select
otherservertable.*
from
linkserver.otherservertable
left join
mytable
on
otherservertable.key = mytable.key
where
mytable.key is null

MVC 4.0 simple membership database

I am aware of old membership and familiar with aspnet_regsql.exe concept. Now I'm using asp.net MVC4.0 (Visual Studio 2013). How do I get new simple membership table of MVC 4.0 in SQL server management studio.
The tables are created automatically the first time you try to register a user.
so if you want to access those table via SQL server,you need create one database in sql server and replace default connection string in web.config with (new database) connection string.
so now membership table will created in your new database
See this link.
if I understand you correctly, you need to using InitializeSimpleMembershipAttribute
where most interest is the following code
WebSecurity.InitializeDatabaseConnection("EFDBContext", "UsersTable", "UserId", "Login", autoCreateTables: true);
Where:
- EFDBContext (connection string name)
after which all the necessary tables will Create, in particular
webpages_Membership
webpages_Roles
webpages_UsersInRoles

Copy or create an SQL table in windows mobile services from Windows Store App

In "regular" SQL, we can create tables by sending queries like:
CREATE TABLE table_name
(
column_name1 data_type,
column_name2 data_type,
column_name3 data_type,
....
)
... and can copy tables as such:
CREATE TABLE new_table AS (SELECT * FROM old_table);
Now skip over to the Windows Azure Mobile Services world, and its "special" SQL. I am having good success creating tables using the Azure portal (non-programmatically) and then accessing these tables as such:
var mobClient = new MobileServiceClient("[url]", "[app key]");
var mobTable = mobClient.GetTable<MyTableClass>();
Browsing the intellisense for the client showed no options for create or copy table.
Is it possible in Windows Azure Mobile Services, and its unique brand of SQL, to create new tables or copy existing ones, programmatically from the app? Anyone know how?
Thank you.
I actually found out on msdn from Microsoft that this is not possible with Azure today. I submitted it as a feature request.
One nice feature, which I have been using, is the dynamic schema. If you have a table definition class in your project in Visual Studio, whose name matches an Azure table, when you make a change to your VS class, the Azure SQL table updates automatically. You still have to double check and fine tune things, but is still handy.
You enable dynamic schema on this page:
can you not send the SQL via the mssql object?