Dynamics 365 virtual entities from Cosmos DB - azure-cosmosdb

The “Azure Cosmos DB for DocumentDB API Data Provider” does not seem to be actively maintained and I was not able to get it to work in D365 CE. I would like to use my Cosmos TB to be the source for some virtual entities in my CRM and the only way I can get this to work is writing a data provider plugin or creating an api. Is anyone aware of any other method to accomplish this?

I believe you will have to expose your database or
Particular table as Odata v4.0 webapi.
Or you could create your own data provider and expose your data through that data provider.
This is how data shall be available in virtual entity.
Note: your odata or custom data provider should respect field types of Crm.
For ex: 1 mandatory EDM.Guid field and so
On.

Related

Entity Framework working with SQL Server views for ASP. NET web api

I am researching my first RESTful API project to interact with the automation side of our ERP system.
I am planning a SPA like here
The simple web page is to provide users with a list of purchase requisitions they must approve or decline.
The app will retrieve the data from a SQL Server view into a collection. As the user approves or declines the requisition this is recorded in the object and when the User presses 'Update ERP' the app will build a XML list of the collection and using a SQL Server stored procedure insert it into the SQL database of the ERP for the automation process to pick up and process
I have three questions
The examples uses SQL Server tables in EF should I build the view in the "model" (some how!) or can I use my SQL Server view?
If I use my SQL Server view, does it need an ID / unique key column (for example row number) to make EF work better?
Would be better using a C# class to do the data retrieval and sending the xml data into the database with SQL Server stored procedure than EF?
The exampe uses SQL tables in EF should I build the view in the
"model" (some how!) or can I use my SQL view?
Use the "Code First to an Existing Database" workflow, and you can select the views from the database, and EF will generate the classes.
If I use my SQL view does it need an ID/ unique key column (for
example row number) to make EF work better?
EF will try to identify the key columns, but it's not very smart about it. You can change the model after the initial generation. The key doesn't matter very much if you don't update the entities, but every Entity still needs a key.
Would be better using a C# class to do the data retrieval and sending
the xml data into the database with SQL stored procedure than EF?
No I would use EF for the retrieval, but probably straight ADO.NET to call the stored procedure.

How to create multiple instance in sql server dynamically in a SAAS environment?

I want to create a new project on contract management system. In this I have to manage multiple organizations and want to create new instance in sql server dynamically for each organization in a saas environment. How is this posiible? I am using asp.net for development. Any help would be appreciated.
A true SaaS application has a single application and database. It has the ability to have multiple tenants use the application. All data in the database needs to know what tenant it belongs too.
For instance if you have a booking system: Your customers sign up to use the software and become a row in the customer table with an ID. When a booking is made it has a customerID column as a foreign key to the customer table. Then all reports, booking views etc are done for that tenant using their customer id. You as a service provider can then run reports on all customers/tenants for your own purposes. Multiple tenants can use the system and all their data be in the same set of tables. This then means when you need to cluster replicate backup etc it is a single db, and a single migration for schema updates.
See these wiki's on multitenancy and SaaS
This of course requires your DB schema (and your app) to support this - if you are unable to change the schema then there are a number of options to up a new DB based upon the technology you are using. If you are using code first EF, then there will be db creation and migration scripts you can use. Otherwise it may justhave to be a sql script you have to generate and then maintain and run this each time a new customer is required. Personally i would rather have a single DB with an appropriate schema.

How to create federation in an existing azure sql database

Am very new to azure federation.In my project there is an existing SQL azure database and now we want to use azure federation for scaling that database.
How can I achieve this on my existing table myCustomer. Am planning to federate the table based on customer_Id. any relevant tutorial available?.From where should i begin.
By Federation do I have to change my existing queries used in the project.?
Thanks.
A rough summary of the changes you need to make to federate your database are:
Decide on an id you will federate on (e.g. user id)
For each table you wish to federate alter your table schema so the federation key is part of the primary key, and annotate the table so it knows which column is the federation key.
For each query that is run against a federated table you need ensure that the connection used is redirected towards the correct federation.
This last step is currently done by adding the USE FEDERATION statement to your queries. It can be a little tricky to implement if you are using Entity Framework or Linq. Something else to be cautious of in this area is making sure the USE FEDERATION statement is re-run if your transient error handling kicks in.
The links Alexander posted are all good to read.
Did you read the article by George Huey in MSDN Magazine?
It covers transition from an existing SQL or Azure SQL DB to a DB with federations in the section called "Migrating Database Schema from SQL Server or SQL Azure to SQL Azure Federation".
Right after that I would recommend to read the tutorial on data querying (part1, part2).
You will have to change your queries if they want to access the data from federations. Basically, every federation is an independent SQL database and you have first to establish connection to correct federation before querying for data.
There are also some peculiarities how to use federations with Entity Framework, partially due to additional overhead for connection to federation instance, and partially because federations do not provide support for MARS operations (article).

How to apply federation to an existing table

Am very new to azure federation.In my project there is an SQL azure database and now we want to use azure federation for scaling that database.
Is it possible to Federate the existing table ?.
How can I achieve this on my existing table casedetails. Am planning to federate the table based on customer_Id.From where should i begin.
in my scenario casedetails table against customerid which is the FK from Customer table.
Will it affect the queries used in the existing web application to fetch and insert values to the database ?.
How can i migrate data into the federated databse.. I am also facing a problem from identity not supported in federation. few of my tables contains identity specification and lots of data. Please reply if u have any insight relating to the problem.
Thanks in advance.

Connect to SQL Server (view)

I developed a web application running on MySQL and now I need to get some data from another database (Microsoft SQL Server).
The SQL Server administrator creates a view to give me the data I need. Now the question is:
How can I work with this data on my current Symfony2 application?. This data will be only read only data, but eventually I´ll record some of this data on MySQL.
Do I need to develop another app, in python for example, to extract that SQL Server view data and save them into MySQL table?
It doesn't matter for Doctrine that your entities refer to a view or a real table, so declare the entity of view like other entities and use it as you want for queries, relations with other entities, etw.

Resources