How to write a proxy with C#?
i have coding a web application which has multi user. they are select data or insert data every thing is that. But selecting some 开发者_StackOverflow社区data need too many time such as using LINQ or mathematical calculation. i thing that: my user1 :
select * from MyTable -----> save as caching via proxy server in machine
my user2 :
select * from MyTable2 -----> save as caching via proxy server in machine
my user3 :
insert into MyTable2 -----> Update caching(select * from MyTable2) via proxy server in machine
How to write a proxy server to select Faster and update select result if another user update table?
I guess I understand what you mean. If you want to achieve the result shown on your drawing, then one way would be to have server cache all the data which is requested by any machine. I think this is too much overhead in terms of the memory, but you can accomplish this in many ways. For example, create a proxy class which handles all database calls and then caches the results. Whenever next call is done, the handler class checks the proxy and returns if such exists; if not, then it makes a call and adds results to the cache.
BTW, I think this part is already taken into account by existing ORMs, no?
Why would you want a Proxy for that?
What you want to accomplish is one of the benefits of use ADO Entity Framework
You have tutorials everywhere in the web, but you can start with this one
ADO Entity Framework is smart enough to cache objects that are used many times and refresh them when they are not in sync, they also have a series of fantastic properties like late-binding and concurrency handling.
精彩评论