在 UWP 中,我享受使用 SQLite.Net-PCL 的好处,创建要在应用程序中使用的类作为 ObservableCollections 以绑定到 GridView。在包含 SQLiteNetExtensions 以构建带有外键的数据库后,我注意到在 SQLite Maestro 中查看数据库时并未真正创建外键。而是创建索引。 如果 SQLiteNetExtensions 并没有真正创建外键,那么使用它有什么好处?
使用 LAMDA 表达式或 LINQ 进行查询时,可能不需要外键(稍后在创建数据库后的应用程序中)。 如果我在不使用 SQLite.Net-PCL 的情况下执行查询以创建带有外键的表,我是否仍然可以使用 SQLite.Net-PCL 继续将 ObservableCollections 绑定到 GridViews?
示例数据库:
[Table("Book")]
public class Book
{
[PrimaryKey, AutoIncrement, Column("ID")]
public int ID { get; set; }
[Column("Name")]
public string Name { get; set; }
[ManyToMany]
public List<Checkout> Checkout { get; set; }
}
[Table("School")]
public class School
{
[PrimaryKey, AutoIncrement, Column("ID")]
public int ID { get; set; }
[Column("Name")]
public string …
Run Code Online (Sandbox Code Playgroud) 下面的代码(JSFiddle Preview)与其他现代浏览器相比,在Webkit中产生了意想不到的结果:
<script type="text/javascript">
jQuery(document).ready(function($) {
RunFunction();
$('.ColorSquare').click(function() {
$('#Lightbox').css('display','block');
$('#ShowColorSquare').css('display','block');
$('#ShowColorSquare').css('z-index','10');
$('#ShowColorSquare').css('left',$('#ShowColorSquare').parent().width() / 2 - 50);
$('#ShowColorSquare').css('top',$('#ShowColorSquare').parent().height() / 2 - 50);
$('#ShowColorSquare').html('The color is: ' + $(this).css('background-color'));
});
$('#ShowColorSquare').click(function() {
$('#Lightbox').css('display','none');
$('#ShowColorSquare').css('display','none');
$('#ShowColorSquare').html('');
});
$('#Lightbox').click(function() {
$('#Lightbox').css('display','none');
$('#ShowColorSquare').css('display','none');
$('#ShowColorSquare').html('');
});
});
function RunFunction() {
$('#slide1').animate({
left: '-=310'
}, 3000);
$('#slide2').animate({
left: '-=310'
}, 3000);
$('#slide3').animate({
left: '-=310'
}, 3000, function() {
if($('#slide1').css("left") == '-310px') {
$('#slide1').css("left",620);
}
if($('#slide2').css("left") == '-310px') {
$('#slide2').css("left",620);
}
if($('#slide3').css("left") == '-310px') { …
Run Code Online (Sandbox Code Playgroud) 通过REST从当前用户的配置文件获取URL时,更新src时将无法显示image标签:
<img id="escMyPic" src="" alt="" />
<script type="text/javascript">
$.ajax({
url: strURL + "/_api/sp.userprofiles.peoplemanager/getmyproperties",
type: "GET",
headers: {
"accept": "application/json;odata=verbose",
},
success: MyPictureSucceeded,
error: MyPictureFailed
});
function MyPictureSucceeded(data) {
if(data.d.PictureUrl != null) {
$('#escMyPic').attr('src', data.d.PictureUrl);
}
}
function MyPictureFailed() {
alert('Error: Unexpected error loading profile picture.');
}
</script>
Run Code Online (Sandbox Code Playgroud)
在SharePoint Online中,返回URL如下所示:https : //tenant-my.sharepoint.com : 443/ User%20Photos/ Profile%20Pictures/email_address_MThumb.jpg?t=63601764394
它将重定向到:https : //tenant-my.sharepoint.com/User%20Photos/Profile%20Pictures/email_address_MThumb.jpg?t=63601764394
使用浏览器开发工具,您会看到返回的mime类型不是image / jpg,而是text / plain。我删除了查询字符串参数,甚至将硬编码URL放在了图像标签src中,但它只是不显示。开发工具中的响应正文也为空白。在显示之前,它似乎正在重定向和认证。
将硬编码的URL放置在浏览器地址栏中时,图片会显示正常,而dev工具的响应标头将图片显示为URL的内容,而MIME类型是image / jpg。
您如何从REST呼叫中显示个人资料图像?
sharepoint office365 sharepoint-2013 office365-apps office365-restapi
c# ×1
css3 ×1
html ×1
html5 ×1
jquery ×1
office365 ×1
sharepoint ×1
sqlite-net ×1
uwp ×1
webkit ×1