ASP。NET MVC应用程序,SQLLite作为离线存储。

时间:2021-11-07 17:16:14

I am developing a web application using asp.net MVC. I need to be able to bring the entire application offline upon user's demand via HTML5.

我正在使用asp.net MVC开发一个web应用程序。我需要能够根据用户的需要通过HTML5使整个应用程序脱机。

Though I can create manifest and have the files such as CSS/JS/image files offline. I am not sure how to have database connectivity offline (something like SQLLite I suppose?)

虽然我可以创建manifest并使CSS/JS/image文件离线。我不知道如何在脱机时进行数据库连接(我想应该是SQLLite之类的吧?)

I need this supported in IE 8+, Safari (IOS) and chrome (android).

我需要在IE 8+, Safari (IOS)和chrome (android)中支持。

I cannot use just local storage as there are a lot of look up values that need to be made available when browsing the application offline. This means that lot of data needs to be stored offline by the approval of the user.

我不能只使用本地存储,因为在离线浏览应用程序时需要大量查找值。这意味着需要通过用户的批准来离线存储大量数据。

Any thoughts?

任何想法吗?

1 个解决方案

#1


1  

For the IE8+, Safari, & Chrome support, you should go with SequelSphere: www.SequelSphere.com

对于IE8+、Safari和Chrome的支持,您应该使用SequelSphere: www.SequelSphere.com

SequelSphere is the only relational database product that has truly broad browser and platform support. It also works "offline" by using the application cache manifest, and will store its data in IndexedDB or LocalStorage (in that order based on availability).

SequelSphere是唯一具有广泛浏览器和平台支持的关系数据库产品。它还可以使用应用程序缓存清单进行“脱机”,并将其数据存储在IndexedDB或LocalStorage中(基于可用性的顺序)。

As for WebSQL (SQLLite), it isn't supported in IE and Firefox: WebSQL Usage by Browser

至于WebSQL (SQLLite),它不支持IE和Firefox:浏览器使用WebSQL

Concerning SequelSphere, creating tables couldn't be easier:

关于SequelSphere,创建表是再容易不过的了:

db.catalog.createTable({
    tableName: "EMPL",
    columns: [ "EMPL_ID", "NAME", "AGE", "DEPT_ID" ],
    primaryKey: [ "EMPL_ID" ],
    data: [
        [0,"Bob",32,0],
        [1,"John",37,2],
        [2,"Fred",28,1]
    ]
});

Querying the data is easy:

查询数据很容易:

var res = db.query("SELECT name, age, dept_id FROM empl WHERE Dept_ID = 2");

Inserting / Updating / Deleteing data is easy:

插入/更新/删除数据很容易:

db.insertRow("empl", [3, "Sue", 26, 2]);
db.updateRow("empl", [3, "Suzy", 26, 2]);
db.deleteRow("empl", [3, "Suzy", 26, 2]);

One thing to be aware of: Since this will be used in an offline application, make sure you set the "Persistence Scope" of either the entire Catalog, or each Table to be "SCOPE_LOCAL":

需要注意的一点是:由于这将在脱机应用程序中使用,请确保您将整个目录或每个表的“持久性范围”设置为“SCOPE_LOCAL”:

db.catalog.setPersistenceScope(db.SCOPE_LOCAL);
//  -or-
db.catalog.getTable("empl").setPersistenceScope(db.SCOPE_LOCAL);

If you have any questions, just email the support for SequelSphere.

如果你有任何问题,只要发邮件给对SequelSphere的支持。

For complete transparency, I am part of SequelSphere, and it does seem to answer your question very well... ;)

为了完全透明,我是SequelSphere的一部分,它似乎很好地回答了你的问题……,)

#1


1  

For the IE8+, Safari, & Chrome support, you should go with SequelSphere: www.SequelSphere.com

对于IE8+、Safari和Chrome的支持,您应该使用SequelSphere: www.SequelSphere.com

SequelSphere is the only relational database product that has truly broad browser and platform support. It also works "offline" by using the application cache manifest, and will store its data in IndexedDB or LocalStorage (in that order based on availability).

SequelSphere是唯一具有广泛浏览器和平台支持的关系数据库产品。它还可以使用应用程序缓存清单进行“脱机”,并将其数据存储在IndexedDB或LocalStorage中(基于可用性的顺序)。

As for WebSQL (SQLLite), it isn't supported in IE and Firefox: WebSQL Usage by Browser

至于WebSQL (SQLLite),它不支持IE和Firefox:浏览器使用WebSQL

Concerning SequelSphere, creating tables couldn't be easier:

关于SequelSphere,创建表是再容易不过的了:

db.catalog.createTable({
    tableName: "EMPL",
    columns: [ "EMPL_ID", "NAME", "AGE", "DEPT_ID" ],
    primaryKey: [ "EMPL_ID" ],
    data: [
        [0,"Bob",32,0],
        [1,"John",37,2],
        [2,"Fred",28,1]
    ]
});

Querying the data is easy:

查询数据很容易:

var res = db.query("SELECT name, age, dept_id FROM empl WHERE Dept_ID = 2");

Inserting / Updating / Deleteing data is easy:

插入/更新/删除数据很容易:

db.insertRow("empl", [3, "Sue", 26, 2]);
db.updateRow("empl", [3, "Suzy", 26, 2]);
db.deleteRow("empl", [3, "Suzy", 26, 2]);

One thing to be aware of: Since this will be used in an offline application, make sure you set the "Persistence Scope" of either the entire Catalog, or each Table to be "SCOPE_LOCAL":

需要注意的一点是:由于这将在脱机应用程序中使用,请确保您将整个目录或每个表的“持久性范围”设置为“SCOPE_LOCAL”:

db.catalog.setPersistenceScope(db.SCOPE_LOCAL);
//  -or-
db.catalog.getTable("empl").setPersistenceScope(db.SCOPE_LOCAL);

If you have any questions, just email the support for SequelSphere.

如果你有任何问题,只要发邮件给对SequelSphere的支持。

For complete transparency, I am part of SequelSphere, and it does seem to answer your question very well... ;)

为了完全透明,我是SequelSphere的一部分,它似乎很好地回答了你的问题……,)