ASP.NET MVC 4相关 [英] ASP.NET MVC 4 Related

查看:61
本文介绍了ASP.NET MVC 4相关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Team,



我的方法是开发Unique产品,我想要我的应用程序的单个URL。我们说,例如:www.example.com。现在我的要求就是这样,

URL应保持相同,但我有不同的客户端,意味着不同客户的不同数据库。所以请告诉我如何使用网站URL为不同的客户映射到不同的数据库



。所以,请让我知道我该如何管理,或者是否有任何IIS级设置等?

解决方案

您必须有一个登录数据库,其中包含连接字符串用于该特定客户端并将其重定向到应用程序。您必须注意以会话,cookie或其他一些持久的方式维护连接字符串。



可能更好的设计(取决于您的特定设置,但对于Web它几乎总是更好)只是拥有单个数据库并使用clientID限定所有相关表。这样,所有(货币,国家/地区等)共同的数据可以是常见的查找表,产品和类别将全部在单个表中,但使用clientID。

ie

 TABLE产品
product_id int
client_id int
product_code
product_name
price
discount





然后在登录时,您知道哪个客户端已登录,如果相关,所有查询都将被客户端过滤

< pre lang =SQL> SELECT * FROM 产品其中 client_id = @ client_id







如果这有帮助,请花时间接受解决方案。


Hi Team,

My Approach is of develop Unique product , where i want the Single URL of my application . Let's Say Eg: www.example.com . Now my requirement is Such that ,
the URL should remain Same , but I have different clients , Means Different databases for different clients. So please let me know how could i map to different databases for

for Different clients With Website URL . So please let me know how do i manage , or is there any IIS level Settings etc?

解决方案

You have to have one database for logins which will contain connection string to use for that particular client and redirect him further into the application. You have to take care to maintain the connection string in session, cookie or some other persistent way.

Possibly better design (depends on your particular setup, but for web it is almost always better) would be to simply have single database and qualify all relevant tables with clientID. That way data that is common to all (currencies, list of countries etc) can be common lookup tables and products and categories would be all in single table, but with clientID.
i.e.

TABLE products
    product_id int
    client_id int
    product_code
    product_name
    price
    discount



Then on login, you know which client is logged in and all queries will be filtered by client if it is relevant

SELECT * FROM products where client_id = @client_id




If this helps please take time to accept the solution.


这篇关于ASP.NET MVC 4相关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆