使用SQL Server CE存储临时数据是否合理?

时间:2023-02-05 10:20:56

I'm writing a web app using ASP.NET MVC4 and SQL Server 2012.

我正在用ASP写一个网页应用。NET MVC4和SQL Server 2012。

At some point in my web app I need to store some data from different pages in my web app and after showing the whole data on a single page to the user, if the user confirmed and there were no validation errors I will store the confirmed data to SQL Server. This web app has a huge number of users.

在我的web应用程序需要存储一些数据从不同的页面在我的web应用程序,展示整个数据在一个页面给用户,如果用户确认,没有验证错误我将确认数据存储,SQL Server。这个web应用程序有大量的用户。

Is it logical and performance wise to use SQL Server CE as a temporary storage and store the data before confirmation on SQL Server CE?

在SQL Server CE确认之前,使用SQL Server CE作为临时存储并存储数据是否符合逻辑和性能?

Are there any other options that I can use?

我还有别的选择吗?

What about localDb?! is it better to use localDb instead of SQL Server CE in this case?

localDb呢? !在这种情况下,使用localDb而不是SQL Server CE更好吗?

2 个解决方案

#1


1  

Because of company policy and because of SQL Server CE constraint like the number of concurrent connections which is 256 i used another approach. I used serialization to keep state of my objects. something like this :

由于公司政策和SQL Server CE约束,比如并发连接的数量为256,我使用了另一种方法。我使用序列化来保持对象的状态。是这样的:

http://highoncoding.com/Articles/647_Creating_Wizard_Using_ASP_NET_MVC_Part_1.aspx

http://highoncoding.com/Articles/647_Creating_Wizard_Using_ASP_NET_MVC_Part_1.aspx

http://highoncoding.com/Articles/652_Creating_Wizard_in_ASP_NET_MVC_Part_2.aspx

http://highoncoding.com/Articles/652_Creating_Wizard_in_ASP_NET_MVC_Part_2.aspx

 public static string Serialize(this object o)
    {
        var sw = new StringWriter(); 
        var formatter =  new LosFormatter();
        formatter.Serialize(sw, o);

        return sw.ToString(); 
    }

    public static object Deserialize(this string data)
    {
        if(String.IsNullOrEmpty(data))
            return null; 

        var formatter = new LosFormatter();
        return formatter.Deserialize(data); 
    }

#2


0  

Have you considered using the session state to store values? http://msdn.microsoft.com/en-us/library/ms178581%28v=vs.100%29.aspx

您是否考虑过使用会话状态来存储值?http://msdn.microsoft.com/en-us/library/ms178581%28v=vs.100%29.aspx

#1


1  

Because of company policy and because of SQL Server CE constraint like the number of concurrent connections which is 256 i used another approach. I used serialization to keep state of my objects. something like this :

由于公司政策和SQL Server CE约束,比如并发连接的数量为256,我使用了另一种方法。我使用序列化来保持对象的状态。是这样的:

http://highoncoding.com/Articles/647_Creating_Wizard_Using_ASP_NET_MVC_Part_1.aspx

http://highoncoding.com/Articles/647_Creating_Wizard_Using_ASP_NET_MVC_Part_1.aspx

http://highoncoding.com/Articles/652_Creating_Wizard_in_ASP_NET_MVC_Part_2.aspx

http://highoncoding.com/Articles/652_Creating_Wizard_in_ASP_NET_MVC_Part_2.aspx

 public static string Serialize(this object o)
    {
        var sw = new StringWriter(); 
        var formatter =  new LosFormatter();
        formatter.Serialize(sw, o);

        return sw.ToString(); 
    }

    public static object Deserialize(this string data)
    {
        if(String.IsNullOrEmpty(data))
            return null; 

        var formatter = new LosFormatter();
        return formatter.Deserialize(data); 
    }

#2


0  

Have you considered using the session state to store values? http://msdn.microsoft.com/en-us/library/ms178581%28v=vs.100%29.aspx

您是否考虑过使用会话状态来存储值?http://msdn.microsoft.com/en-us/library/ms178581%28v=vs.100%29.aspx