Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
373 views
in Technique[技术] by (71.8m points)

javascript - 我的Web API的最佳架构是什么? [等候接听](What is the best architecture for my web API? [on hold])

I am working on my exam project and have made an MVC project with that includes a complex data model.

(我正在做我的考试项目,并制作了一个MVC项目,其中包括一个复杂的数据模型。)

I have to make a WebAPI as well.

(我也必须制作一个WebAPI。)

My MVC Project is really good.

(我的MVC项目真的很好。)

The Microsoft MVC tutorial was really good.

(Microsoft MVC教程非常好。)

My problem now is how do I make a WebAPI for my MVC project.

(我现在的问题是如何为我的MVC项目制作WebAPI。)

I have done the tutorial my teacher gave us but am still struggling to figure it out.

(我已经完成了老师给我们的教程,但仍在努力找出答案。)

The following pic shows the architecture of my MVC project:

(下图显示了我的MVC项目的体系结构:)

VitekSky MVC项目

I now have to make WebAPI project in the same solution.

(我现在必须在相同的解决方案中制作WebAPI项目。)

And I think its easiest to connect it to the same database by copying tha Data folder from VitekSky.

(而且我认为通过从VitekSky复制tha Data文件夹将其连接到同一数据库是最容易的。)

The Data folder includes my Context file.

(数据文件夹包括我的上下文文件。)

And I have also copied the all the models from VitekSky over to a models folder which I have made in VitekAPI.

(而且我还将所有模型从VitekSky复制到了我在VitekAPI中制作的models文件夹中。)

I have done the Microsoft API Tutorial but am lost.

(我已经完成了Microsoft API教程,但迷路了。)

I need to make an API Which I can test via Postman and I also need to afterwards call it via Javascript.

(我需要制作一个可以通过Postman进行测试的API,然后还需要通过Javascript对其进行调用。)

I know how to test it via postman after I am done and I have an idea on how to call an API via javascript after I am done with the API.

(我知道完成后如何通过邮递员对其进行测试,并且我对完成API后如何通过javascript调用API有了一个想法。)

I have tried to speak with other students in my class and they only have 1 or 2 classes in the models folder in the MVC project and also in the API project but I do not think I can do that because I have a complex datamodel.

(我曾尝试与班上的其他学生交谈,他们在MVC项目和API项目的models文件夹中只有1或2个班级,但我认为我不能这样做,因为我有一个复杂的数据模型。)

ProductGuide and Customer tables inherit from the person table in the database.

(ProductGuide和Customer表继承自数据库中的person表。)

I would really like an API where I can send http requests to make changes in my product table.

(我真的很想要一个API,我可以在其中发送http请求以在产品表中进行更改。)

But my product table also references the Market, Subscription and ProductAssignments table.

(但是我的产品表还引用了市场,订购和产品分配表。)

From Product.cs file:

(从Product.cs文件:)

    public Market Market { get; set; }    
    public ICollection<Subscription> Subscriptions { get; set; }
    public ICollection<ProductAssignment> ProductAssignments { get; set; }

What should I do?

(我该怎么办?)

Have been looking at this for multiple days am a bit lost.

(已经看了很多天了,有点迷路了。)

If there is anything I should edit or add to the post please let me know.

(如果我需要编辑或添加任何内容,请告诉我。)

Help would be appreciated.

(帮助将不胜感激。)

PS.

(PS。)

If you know a tutorial or something we should watch to do this please let us know.

(如果您知道某个教程或我们应该注意的事情,请告诉我们。)

Also for our solution we have to use MVC, EntityFramework,Razor Pages and WebAPIs.

(同样对于我们的解决方案,我们必须使用MVC,EntityFramework,Razor Pages和WebAPI。)

We only have the WebAPI left.

(我们只剩下WebAPI。)

  ask by CodingStudent translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...