我正在使用C#和EF5.0开发一个小项目,我需要对一些数据进行分组.假设我在建筑物中有列表,如下所示.
+----------+--------Columns Table--+------+------+
| ColumnID |ColumnName|Width|Length|Height|number|
+----------+----------+-----+------+------+------+
| 1 | C101 | 50 | 70 | 250 | 1 |
| 2 | C102 | 70 | 70 | 250 | 1 |
| 3 | C103 | 70 | 60 | 250 | 1 |
| 4 | C104 | 90 | 70 | 250 | 1 |
| 5 | C105 | 40 | 50 | 250 | 1 |
| 6 | C106 | 50 | 70 …Run Code Online (Sandbox Code Playgroud) 我正在使用aspnetcore-spa react-redux样板构建我的应用程序(可以在http://blog.stevensanderson.com/2016/05/02/angular2-react-knockout-apps-on-aspnet-core/上看到)
然而,服务器端渲染需要花费很多时间(约30秒),我想禁用它.你能告诉我如何在不破坏代码的情况下禁用服务器端渲染吗?
我是新编码的人.现在我要告诉你我目前的情况以及我想去的地方.希望你会帮忙.
我正在使用EF5.0数据库第一种方法,我希望能够使用gridviews列出和更新数据库值.
目前我正在绑定我的数据,如下所示:
pehlivan_kabametrajEntities ctx = new pehlivan_kabametrajEntities();
var result = from k in ctx.Kolons
select k;
dataGridView1.DataSource = result.ToList();
Run Code Online (Sandbox Code Playgroud)
此代码完美地列出了我的数据.但是对我的需求来说是错误的还是不够的.因为我希望能够在gridview上编辑我的数据.请告诉我有什么问题,我应该怎么做.至少链接的一些文件会让我到达我想要的目的地点,这将是很棒的.谢谢.
嘿,我开始学习foursquare API,但我仍然坚持获取Access Token.这是我在SO中找到的代码的一部分.
// build url
$url = 'https://foursquare.com/oauth2/access_token';
$url .= '?client_id='.CLIENT_ID;
$url .= '&client_secret='.CLIENT_SECRET;
$url .= '&grant_type=authorization_code';
$url .= '&redirect_uri=**********/callback'; //change to your 4sq callback
$url .= '&code='.$code;
// call to https://foursquare.com/oauth2/access_token with $code
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
Run Code Online (Sandbox Code Playgroud)
但是这不起作用,所以我试图找到错误.首先回显$ url并手动点击该链接.它运作了,foursquare给了我一个json格式的访问令牌.所以问题在于代码的卷曲部分.
你能找到我的错误吗?更重要的是,你能给我一些研究卷曲的资源吗?
编辑:我做了一个var_dump($ result),输出为'boolean false'
我试图在我的实体中实现属性版本跟踪.使用TrackedProperty我的可跟踪属性的模式;
public class PropertyVersion<TValue, TVersion>
{
public TVersion Version { get; set; }
public TValue Value { get; set; }
}
public class TrackedProperty<TValue, TVersion> : List<PropertyVersion<TValue, TVersion>>
{
}
Run Code Online (Sandbox Code Playgroud)
例如,在我的存储库中,我将保留TrackedFoo对象,并且我将能够在特定版本(在这种情况下,版本被描述为Time对象)中检索数据Foo.
public class TrackedFoo
{
public string Id { get; set; }
public TrackedProperty<string, DateTime> Name { get; set; }
}
public class Foo
{
public string Id { get; set; }
public string Name { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我想尽可能保持通用.所以我尝试使用AutoMapper,但我无法以通用方式配置它,我不需要配置每个映射TrackedTypeX到TypeX …
我使用IdentityServer4和Asp.NET Core上的Asp.NET Core Identity构建了身份服务器。我想将我的ApplicationUser的属性映射到客户端访问UserInfoEndpoint时发送的声明。
我尝试实现IUserClaimsPrincipalFactory,如下所示:
public class CustomUserClaimsPrincipalFactory : IUserClaimsPrincipalFactory<ApplicationUser>
{
public async Task<ClaimsPrincipal> CreateAsync(ApplicationUser user)
{
var principal = await CreateAsync(user);
((ClaimsIdentity)principal.Identity).AddClaims(new[] {
new Claim(ClaimTypes.GivenName, user.FirstName),
new Claim(ClaimTypes.Surname, user.LastName),
});
return principal;
}
}
Run Code Online (Sandbox Code Playgroud)
并像这样注册:
services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders()
.AddClaimsPrincipalFactory<CustomUserClaimsPrincipalFactory>();
Run Code Online (Sandbox Code Playgroud)
但是当客户端尝试访问UserInfoEndpoint时,我得到了StackOverflowException。
你能帮我解决这个问题吗?
注意:我已经对其进行测试,并且在未注册ClaimsPrincipal工厂时也没有出现任何错误。
使用此代码我没有错误
public static void kirisekle(string kirisadi, int genislik, int derinlik, int uzunluk, int katid)
{
Beam newbeam = new Beam { Kirisadi = kirisadi, Geni?lik = genislik, Derinlik = derinlik, Uzunluk = uzunluk, KatID = katid };
using (pehkEntities context = new pehkEntities())
{
context.Beams.Add(newbeam);
context.SaveChanges();
}
}
Run Code Online (Sandbox Code Playgroud)
但是,使用此代码时出现"dbupdateexception未处理"错误
public static void dosemeekle(string dosemeadi, int en, int boy, int kalinlik, int katid)
{
Slab newslab = new Slab { DosemeAdi = dosemeadi, En = en, Boy = boy, Kal?nl?k = …Run Code Online (Sandbox Code Playgroud) 对于我正在从事的项目,我需要使用公共身份服务器创建两个单独的(但并非完全无关)应用程序。我为此选择了IdentityServer4,它对我来说很好用。
但是,我需要能够将用户分配到多个公司/项目(是的,这是现实生活中的情况),并且可能在每个公司/项目中分配不同的角色。但是,我无法为此设计索赔结构。
我看到两种可以解决此问题的方法;
为每个公司/项目创建一个复杂的声明,其中将包含companyId和用户在该公司中的角色。可以是JSON形式,也可以是自定义字符串,例如,companyGUID_roleClaim
但是,当我进行小型研究时,我意识到有很多人认为这不是正确的方法,因为他们认为声明应该是简单的键值对。
让应用程序连接/查询身份数据库,以检索与活动用户关联的公司/项目和角色,并使用基于这些数据的策略来保护资源。
也许我从错误的角度看待它,或者这两个中的一个是可以接受的。或者还有另一种解决方案。您能帮我找到解决这个问题的方法吗?
让说,我有我的user控制器有action_index(),action_login(),action_logout() action_profile($userid) 在它的方法.我想做一个路由
www.mysite.com/user/xxxx
Run Code Online (Sandbox Code Playgroud)
检查xxxxurl 的一部分,如果它不是(login,logout,index)之一,则调用action_profile(xxxx)方法.
现在我这样做:我的路由路由所有www.mysite.com/user/xxxx类型的请求action_index,它检查是否xxxx是方法名称.如果它不是它调用的方法名称action_profile(xxxx)
但是,我认为有可能以更好的方式.我怎样才能做得更好?
问题很明显我认为,虽然我用Google搜索,但我找不到任何解决方案.我想划分我的源代码以使其更易于维护.如何引用另一个文件中的模块?