I followed very simple example from www.asp.net to create Web API project using Empty project template for Web API. This tutorial does not create database instead it just create model class and seed data inside api controller.
I successfully consumed API controller using angular service and able to show data on UI. Till here everything is fine.
However, moving one step further i would like create database but not sure about the steps.
I don't want to follow some other tutorial available on same site which does all of these things because i am not understand the overall concept even though i'll able to create database. Also, tutorial talks about using MVC approach which i dont want to use. I just looking for Web API, EF and Angular combination.
Can someone guide me for writing context class and overall database creation steps.?
Related
Using custom connector i am able to load data from mysql to s3 in AWS Appflow but when creating a new table in mysql, it is not showing up in Appflow console.
New entities are discovered during the ListEnties event that is called recursively when building a flow amd selecting the source object. Since you are building a custom connector all the logic of how the connector discovers entities is in your custom code. Specifically the list_entities method of your MetadataHandler.
See the end-to-end flow of the readme of the Python custom connector SDK. I quote part here.
https://github.com/awslabs/aws-appflow-custom-connector-python
Step 5: AppFlow user then uses that ConnectorProfile to create Flow definitions. During the flow creation AppFlow invokes listEntity and describeEntity functions on the connector to retrieve the list of supported entities and the entity detail of the specific entity AppFlow user selected on the console / API.
With that said, if you can share im your question the code of your metadata handler as well as a description of the source database and why you think the new table should be discovered by your code.
I would also look at the CloudWatch logs or whereever you store logs for the Lambda hosting your custom connector. View the logs after trying to build a flow and not seeing the expected new entities listed. If there is an error trying to read a new entitiy you could see it here if you have the proper logging setup.
All of the examples for ACS are using Nodejs and VS Code... and thats fine if you're building a new app, and if you have some kind of background with React. I do not... and I'm willing to bet most web devs maintaining and builing MVC apps don't.
I'm not so daft that I can't get a Nodejs app working, I can get the web calling hero sample to run without any issues...
However, I think for MVC we probably should be looking at this solution
https://github.com/Azure/communication-ui-library/tree/main/samples/StaticHtmlComposites
and I can't get it going... Not only that... but even if I did get it running how would one implement into an existing MVC app...
Has anyone successfully implemented ACS web calling/video into an existing MVC app, and how did you do it? ...the internet is currently a barren wasteland when it comes to this topic.
ANSWER as of 7/7/2021
Step 1: Follow all of the steps from here
https://github.com/Azure/communication-ui-library/tree/main/samples/StaticHtmlComposites
Step 2: Take the newly created/bundled callComposite.js file and add it to your existing or new MVC web project. I added mine to wwwroot/js...
Step 3: Create a view (however you choose to do that...) and copy the html and javascript from the index page in the project I linked to above. (if you don't care about chat you can remove all the related js). You'll need to replace the callComposite.js script link with the newly added one.
Step 4: You need a controller that will generate the token and userId.
I created a web api controller so that a new token and userId was generated essentially when the page was loaded. NOTE: make sure you're using async javascript OR just put the callAdapter code block in a timeout (mine is 2 seconds with a loading screen) Secondary Note: I got all of the code from the Web Calling Hero Sample out of the calling/controllers/UserTokenController.cs
Final step: say a small prayer, cross your fingers, grab a rabbits foot and rub it. then run it and it could/might/probably/possibly work the first time... but probably not. you'll need to adjust for your own set up.
For you future people. Please post an updated solution. This is literally the only resource for Azure Communication Services Web Calling on MVC on the internet (as of the time of this posting). Be a hero, tell us a better, easier way.
I have a number of tables inside a database that I use for 4-5 different websites. These tables already exist and have plenty of data and views/stored procedures/functions etc. already completed.
I would like to provide an api to give access to each of these tables to whichever website I happen to be using so they're accessing the data in a consistent manner. I have Visual Studio 2015 and have been trying to create a Web Api using EntityFramework.
However, every tutorial I find for accessing databases insists on creating the database and tables within the code for the api, and utilizes just the tables with the various CRUD actions handled within.
As I have the tables built, I don't want to recreate them, and as I have some programming already in place using functions/stored procs, I don't really want to reinvent the wheel and recreate it all.
I did find this: http://www.c-sharpcorner.com/UploadFile/4b0136/working-with-stored-procedures-using-entity-framework-part/ for EF6 (though I believe I'm using EF7, but that seems to be importing each function in turn, which seems.. kludgy)
So my question is two-fold:
Is ASP.NET 5 web api the right tool for the job?
Can the ASP.NET 5 web api handle stored procedures easily?
At time of writing it's currently easier to build an API over an existing database using ASP.NET 4.6 and EF 6. This tutorial describes how you can go about building a model from an existing database:
http://www.asp.net/mvc/overview/getting-started/database-first-development/creating-the-web-application
Once you have a model and your classes in place, you can then follow any article on scaffolding Web API.
I'm developing an ecommerce based on Websphere Commerce 7 WCS7. I need to import products from an external supplier, which is exposing a webservice. I've already implemented a Controller Command performing all the operation needed to extract the products from the remote service, and I've them avalaible as custom Java classes.
I'm a little bit confused about the approach I should follow in this case. I've defined the attributes needed in my scenario and used the dataload utility to import them in the DB. What should I do next? I expect to be able to "create" WCS product programmatically from my Controller Command but I don't know how to use the attribute I've defined in a programmatic insert.
Can someone point me on the right track on how to perform this kind of operation? I went through the documentation, but, given the fact I'm quite new of the WCS environment, I don't know how to proceed according to the current best practices.
It is possible to create a new catalog entry programmatically if you copy what is being done in the LOBTools. I have not done this myself though. I have always added new products via the data loads and when we did need to add from an external service I just output the information to a file and loaded along with our other products. The reason was due to keeping the catalog in sync with the product management system.
Have a look at the various DataBean classes in WCS, like: CatalogEntryDataBean.
See here for WCS data beans:Link
And here for "activation" of a DataBean:Link
I'm developing an iPad app, which is connected to a Django Server on the backend. The server mostly is just a REST API on top of a database (this is done with TastyPi, for the record).
I'm trying to understand the best way to develop this, since I'm new to iOS.
So a few related questions:
Is there a library that simplifies the work of making "models" in your code that mirror the models on the server?
I would imagine something like Django's ORM, which allows you to define objects in Objective C , that are mapped 1-to-1 to objects that the REST Api gives you.
This library could abstract all of the cache-ing and converting between local objects and the objects on the server.
If this kind of library doesn't exist, are there a set of best-practices for this type of project? For example, should I even have local objects that reflect the DB? Should I have one class which takes care of all the code that deals with the API, or should I write the requests in the many different objects that are part of the API?
In short, where can I learn the "right" way to code iOS apps backed by a REST Api exposing a database? Preferably a tutorial, rather than looking at existing projects' code.
1) For ORM, iOS has Core Data that lets you build your entity and work with objects rather than SQL statements like SELECT, LEFT JOIN etc.
Don't know about others, but this is how I usually do it:
1) App makes a HTTP POST request to the Web Service using a library like ASIHttpRequest library. (Note, for the backend, I wrote my web service using Symfony web framework)
2) The app sends back the JSON response.
e.g.
{
data
{
name: bob
age: 20
}
}
3) Parse the JSON using a JSON parser like JSONKit or the one provided by ASIHttpRequest and convert the JSON server response into a NSDictionary.
NSDictionary *data = [[request responseString] objectFromJSONString];
4) Now whether to store the data on the app or not depends on the nature of the app. If the app is to do searches for local restaurants, then you probably don't want to keep a local copy of the returned result, since the nature of the app is to search for restaurants.
However, if you got like a login system that downloads user's home work from their account, then you would likely store these data on the device locally.
This is where Core Data comes in, you build your model that replicates the server model and you do a simple 1 to 1 mapping between server and client models.
Hope that helps.
Check out Rest kit
RestKit is an Objective-C framework for iOS that aims to make
interacting with RESTful web services simple, fast and fun. It
combines a clean, simple HTTP request/response API with a powerful
object mapping system that reduces the amount of code you need to
write to get stuff done.
It also supports persisting remotely loaded objects directly back into a local store
The Parse.com api is RESTful, and takes care of a kajillion hours of boilerplate code construction for a database. I don't work for them, but I do like the service.
For #1, helios.io does the trick. From the docs at github,
In order to keep your data model and REST webservices in sync, you can link it to your helios application:
$ helios link path/to/DataModel.xcdatamodel
This creates a hard link between the data model file in your Xcode and Helios projects—any changes made to either file will affect both. The next time you start the server, Helios will automatically migrate the database to create tables and insert columns to accomodate any new entities or attribute