I\'m building a chat application and I\'ve reached the part where I\'m creating the actual chat interface. I decided to use the ListView.builder() constructor, as I\'m working with potentially a great amount of data (messages). The layout, and my code in general, look something like this.
I want to preserve the scrolling position at any time, unless the user explicitly scrolls away. Here comes the first issue: when the software keyboard appears, or the size of the input …
我一直在关注本教程:https://azure.microsoft.com/en-us/documentation/articles/cdn-serve-content-from-cdn-in-your-web-application/
直到我注意到,捆绑的脚本和CSS文件与返回的一切都是伟大的cache: no-cache,expires: -1和pragma: no-cache头.当然,这与Azure无关.为了证明这一点,我通过直接从我的网站访问它来测试捆绑,而不是CDN - 即.mysite.com/bundles/mybundle?v={myassemblyversion}.结果是一样的.当我禁用CDN并使用vMVC生成的查询字符串访问捆绑文件时,标头符合预期:公共缓存,到期时间为一年.
我试图实现IBundleTransform接口,但它context.BundleVirtualPath是只读的(即使它说获取或设置虚拟路径......).我也尝试修改响应标头Application_EndRequest(),但它也没有用.我的最后一个赌注是编写IIS出站规则,但由于我的bundle(与"custom"v查询字符串一起使用)不返回Last-Modified标题,所以这也是徒劳的尝试.
我的问题是:如果我希望将捆绑的文件缓存在客户端上,那么我如何使用Azure CDN绑定MVC - 也就是说,直到v查询字符串发生变化?
model-view-controller asp.net-mvc caching azure bundling-and-minification
我是戈尔姆的新手。我尝试进行级联删除,如果我删除用户,则与该用户关联的角色(属于)、配置文件(有一个)和书籍(一对多)也将被删除。
我在下面设置了模型,但级联似乎不起作用。当我删除用户时,角色、个人资料和书籍仍保留在数据库中,而不是被删除/软删除。
有人可以指出我哪里做错了吗?谢谢
用户模型
type User struct {
gorm.Model
Name string `json:"name"`
Age uint `json:"age"`
Profile Profile `gorm:"constraint:OnDelete:CASCADE;"`
RoleID int `json:"role_id"`
Role Role `gorm:"constraint:OnDelete:CASCADE;"`
Books []Book `gorm:"constraint:OnDelete:CASCADE;"`
}
type Book struct {
gorm.Model
Title string `json:"title"`
UserID uint `json:"user_id"`
}
type Profile struct {
gorm.Model
Country string `json:"country"`
UserID uint `json:"user_id"`
}
type Role struct {
ID int
Name string `json:"name"`
}
Run Code Online (Sandbox Code Playgroud)