我有相同的问题.我在我的project.json文件中添加了以下依赖项:
"dependencies": {
"EntityFramework": "7.0.0-beta4",
"EntityFramework.Core": "7.0.0-rc1-final",
"EntityFramework.SqlServer": "7.0.0-beta8",
"EntityFramework.Commands": "7.0.0-rc1-final"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel",
"ef": "EntityFramework.Commands"
},
...Run Code Online (Sandbox Code Playgroud)
我用过dnu install EntityFramework并dnu install EntityFramework.SqlServer安装了这些包.由安装程序自动"EntityFramework": "7.0.0-beta4",在dependencies节点下编写.
问题/问题1:令我惊讶的是,当我EntityFramework提出我所提供的可用版本的智能时,它只是6.1.3!
问题2:当我使用编译我的应用程序时dnu build(我在节点下手动dnu restore添加EntityFramework程序集(.Core和.Commands)之后运行命令)dependencies我收到了一堆编译错误:
The type 'DbContextOptionsBuilder' is defined in an assembly that is not referenced. You must add a reference to assembly 'EntityFramework.Core, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null'.
D:\Projects\aspnet\apiservice\Models\SampleData.cs(12,41): …Run Code Online (Sandbox Code Playgroud)我从我的最后一个问题了解这里该字符串串连不与0.9及以上的允许(目前我迁移到1.0版本).
我必须将每个变量包装在单独的HTML元素中.
但是,有时我需要使用href或class属性动态分配值.我不能让它像以下一样直接工作:
<a href="http://example.com/user/{{userid}}">Link text</a>
Run Code Online (Sandbox Code Playgroud)
因为1.0不允许字符串连接!
请参阅下面的代码段.我试图从我传递一个属性值index.html,反过来应该替换class我的自定义元素内的属性值.但它不起作用,我理解为什么.
<dom-module id="multi-color-bar-chart">
<template>
<div id="chart">
<p>{{title}}</p>
<div class="{{v1bg}}">
<!-- I want {{v1bg}} to be replaced by value sent from index.html -->
<span>{{value1}}</span>%
</div>
<div class="v2" style="background:#ffcc00;">
<span>{{value2}}</span>%
</div>
<div class="v3" style="background:#369925;">
<span>{{value3}}</span>%
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</template>
<script>
(function () {
Polymer({
is: 'multi-color-bar-chart', //registration of element
properties: {
title: { type: String },
value1: { type: String },
value2: …Run Code Online (Sandbox Code Playgroud)我参考https://youtu.be/5lVQgZzLMHc?t=800来构建我的第一个Vuex应用程序。这是 2018 年的教程,所以我的main.js看起来有点不同。我正在使用Vue 3.0.2(如Vue开发者工具所示)。
这就是我的main.js样子:
import { createApp } from 'vue'
import App from './App.vue'
createApp(App).mount('#app')
Run Code Online (Sandbox Code Playgroud)
因此,我对此文件进行了更改以匹配教程中的内容:
import Vue from 'vue';
import App from './App.vue'
new Vue({
render: h => h(App)
}).$mount("#app");
Run Code Online (Sandbox Code Playgroud)
但这给了我以下控制台错误:
Uncaught TypeError: vue__WEBPACK_IMPORTED_MODULE_4__.default is not a constructor
Run Code Online (Sandbox Code Playgroud)
我忽略了它并继续教程。根据教程,我store/index.js使用以下内容创建了文件:
import Vuex from 'vuex';
import Vue from 'vue';
import todos from './modules/todos';
// Load Vuex
Vue.use(Vuex);
// Create the store
export default new Vuex.Store({
modules: {
todos …Run Code Online (Sandbox Code Playgroud) 我回来了新问题并再次寻求专家帮助!
在我的Polymer 0.5项目中,我有一个JSON数组传递给这样的属性:
<horizontal-barset max="3320000" data='[
{"title": "Annuals", "prevord": "1-15-2015",
"ds": [
{"subhead": "Last Year Sales", "value": "2960000", "className" : "last-year"},
{"subhead": "YTD", "value": "1956000", "className" : "ytd"},
{"subhead": "Previous Order", "value": "480000", "className" : "prev-order"}
]
},
{"title": "Perennials", "prevord": "1-15-2015",
"ds": [
{"subhead": "Last Year", "value": "540000", "className" : "last-year"},
{"subhead": "YTD", "value": "2140000", "className" : "ytd"},
{"subhead": "Previous Order", "value": "320000", "className" : "prev-order"}
]
},
{"title": "Totals", "prevord": "1-15-2015",
"ds": [
{"subhead": "Last Year", "value": "3320000", …Run Code Online (Sandbox Code Playgroud)如何访问函数内的属性值?这里是物业
properties:{
name: {type: String}
}Run Code Online (Sandbox Code Playgroud)
<my-element name="Subrata"></my-element>
Run Code Online (Sandbox Code Playgroud)
在里面<my-element>我有一个这样的功能:
方法#1
<my-element name="Subrata"></my-element>
Run Code Online (Sandbox Code Playgroud)
我的另一种方法是将值放在一个元素中,但这也不起作用。
方法#2
<dom-module id="my-element">
<template>
...
...
</template>
<script>
(function () {
is: 'my-element',
properties:{
name: {type: String}
},
getMyName: function(){
return this.name;
}
})();
</script>
</dom-module>Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?请帮忙。
提前致谢
在过去的几天里,我正在寻找一些关于如何使用控制器方法调用Stored Procedure内部的教程.Web APIEntityFramework 7
我通过的所有教程都反过来展示它,即Code First接近.但我已经有了一个数据库,我需要用它来构建一个Web API.各种业务逻辑已经编写为存储过程和视图,我必须使用来自Web API的那些逻辑.
问题1:这是否可以继续使用上述Database First方法EF7并使用数据库对象?
我EntityFramework 6.1.3通过以下NuGet命令安装到我的包中:
install-package EntityFramework
它将6.1.3版本添加到我的项目中,但立即开始向我显示错误消息(请参阅下面的屏幕截图).我不清楚如何解决这个问题.
我有另一个测试项目,在其中project.json我可以看到两个条目如下:
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
"EntityFramework.MicrosoftSqlServer.Design": "7.0.0-rc1-final",
但是,当我在Nu-Get包管理器中搜索时,我不会看到这个版本!只有6.1.3即将到来.
我的主要目标是从现有数据库中使用已编写的存储过程和视图.
1)我不想使用ADO.Net,而是我想ORM使用EntityFramework
2)如果EntityFramework 6.1.3有来电的能力Stored Procs,并Views从已经存在的数据库,我怎么能解决错误(截图)?
实现这一目标的最佳做法是什么?
c# sql-server ef-database-first entity-framework-core asp.net-core-mvc
我在将JSON字符串转换为C#对象时遇到问题.非常基本但没有得到所需的输出.我做错了什么?
这是我的字符串(由Google授权服务器提供)
{
"access_token" : "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
"token_type" : "Bearer",
"expires_in" : 3600,
"refresh_token" : "yyyyyyyyyyyyyyyyyyyyyyy"
}
Run Code Online (Sandbox Code Playgroud)
这是班级:
public class GoogleAuthProperty
{
public string AccessToken { get; set; }
public string TokenType { get; set; }
public long ExpiredIn { get; set; }
public string RefreshToken { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我这样做:
var prop = JsonConvert.DeserializeObject<GoogleAuthProperty>(responseFromServer);
Run Code Online (Sandbox Code Playgroud)
但没有在属性列表中获取任何值 prop
prop.AccessToken is null;
prop.ToeknType is null;
prop.ExpiredIn is 0;
prop.RefreshToken is null;
Run Code Online (Sandbox Code Playgroud)
参考:
Newtonsoft.Json
Version: 4.5.0.0
Run Code Online (Sandbox Code Playgroud) 虽然迁移到聚合物1.0 0.5我也碰到过一件有趣的事情.认为它可能会帮助其他人有类似的问题.
我有一个我正在使用的元素<template is="dom-repeat" items="{{customers}}">...</template>.我面临的问题是我必须将每个属性绑定放在HTML元素中.我想写的代码如下:
<template is="dom-repeat" items="{{customers}}">
<div>
{{item.name}}<br />
{{item.addr}}, {{item.addr2}}<br />
{{item.phone}}
</div>
</template>Run Code Online (Sandbox Code Playgroud)
但它只显示了价值{{item.name}}.原因是其他属性绑定不包含在单独的HTML标记中,它们根本不显示!
我尝试了以下但是也没有工作:
<template is="dom-repeat" items="{{customers}}">
<div>
<p>{{item.name}}</p>
<span>{{item.addr}} {{item.addr2}}</span>
</div>
</template>Run Code Online (Sandbox Code Playgroud)
意味着,我把{{item.name}}一个内<p>...</p>标签,并放置{{item.addr}}和{{item.addr2}}一个内<span>...</span>标签.
然后我继续把每个属性绑定包装在他们自己的HTML标签中,如下所示:
<template is="dom-repeat" items="{{customers}}">
<div>
<p>{{item.name}}</p>
<span style="display:block">{{item.addr}}, <span>{{item.addr2}}</span></span>
<span style="display:block;">{{item.phone}}</span>
</div>
</template>Run Code Online (Sandbox Code Playgroud)
它的工作原理!!
我真的不知道它是1.0的错误还是我做错了!如果有人知道答案,请帮助.
提前致谢
我创建了一个名为的自定义帖子类型user-story。该$args如下所示:
$args = array(
'labels' => $labels,
'hierarchical' => true,
'description' => 'description',
'taxonomies' => array('category', 'story-type', 'genre'),
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'http://webmaster.webmastersuccess.netdna-cdn.com/wp-content/uploads/2015/03/pencil.png',
'public' => true,
'has_archive' => true,
'query_var' => true,
'capability_type' => 'post',
'supports' => $supports,
'rewrite' => $rewrite,
'register_meta_box_cb' => 'add_story_metaboxes' );
register_post_type('user_story', $args);
Run Code Online (Sandbox Code Playgroud)
问题就在这里'taxonomies' => array('category', 'story-type', 'genre'),。我看不到我的分类story-type,并genre在添加新的故事在管理页面。仅category显示。
这两个story-type和genre是自定义分类。我停用了CPT插件(user_story),然后重新激活了它。但是仍然没有超出自定义分类标准。 …
我创建了一个 AWS (Ubuntu 16.04) AMI。安装 WordPress 并上传我的自定义主题。两个操作都很顺利。
我把我的网站放在里面/var/www/html。
这是全新安装。我创建了两个两页/login和/forbidden. 在固定链接页面中,我选择了帖子名称选项。
该站点有.htaccess文件(根),内容如下:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Run Code Online (Sandbox Code Playgroud)
但是每当我尝试访问时,http://ec2-54-174-120-1.compute-1.amazonaws.com/login我都会收到 404 错误。
配置在: /etc/apache2/apache2.conf
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Run Code Online (Sandbox Code Playgroud)
DocumentRoot /var/www/html设置在两个/etc/apache2/sites-availabe/000-default.conf和/etc/apache2/sites-enabled/000-default.conf
我重新启动了 Apache 服务器几次,但都没有成功。
sudo service apache2 restart
apache wordpress amazon-ec2 amazon-web-services ubuntu-16.04
首先我是一名WordPress学习者。如果我的代码看起来很愚蠢,我很抱歉!
我创建了一个具有自定义用户角色的自定义主题。我没有开发任何插件。
在我的 fucntions.php 文件中,我编写了以下代码来创建用户角色。分配给此角色的用户应该登录管理员,但只能访问其个人资料页面。
add_action('init', 'yrc_cst_register_role_customer_service_rep');
/**
* Register new user role
*/
function yrc_cst_register_role_customer_service_rep() {
$wp_roles = new WP_Roles();
$wp_roles->remove_role('subscriber');
$wp_roles->remove_role('editor');
$wp_roles->remove_role('contributor');
$wp_roles->remove_role('author');
$service_rep_caps = array(
'read' => false,
'create_posts' => false,
'edit_posts' => false,
'edit_others_posts' => false,
'publish_posts' => false,
'manage_categories' => false,
'manage_options' => false,
);
add_role('customer_service', __('Customer Service'), $service_rep_caps);
}
Run Code Online (Sandbox Code Playgroud)
我已删除除管理员之外的所有角色,因为此门户不需要其他角色。管理员只会创建具有客户服务角色的用户。
我的系统中没有安装第三方插件。
具有自定义角色的用户可以通过工作正常的自定义登录页面登录系统。但每当他们尝试访问其个人资料页面时,就会出现以下错误消息:
抱歉,您无权访问此页面。
有类似的东西'edit_profile' => true吗?
我一定做错了什么,但我有限的知识不足以弄清楚这一点。任何建议将不胜感激。
我想在Polymer 1.0应用程序中添加一个饼图.我使用chart-elementsPolymer 0.5,但是当迁移到1.0时它停止工作!
我还没找到1.0的任何东西.1.0根本没有现成的图表元素吗?寻求专家帮助.
提前致谢.
编辑
根据Ben的建议我尝试使用google-chart组件,这就是我所做的.但图表没有渲染.
第1步:我google-chart使用安装bower install --save GoogleWebComponents/google-chart
第2步:创建一个自定义元素,使用yo polymer:el custom-pie-chart如下所示:
<dom-module id="custom-pie-chart">
<style>
:host
{
display: -webkit-flex;
display: -ms-flex;
display: flex;
margin: 0;
padding: 0;
width: 400px;
height: 300px;
}
#chartdiv
{
width: 100%;
}
google-chart
{
height: 300px;
width: 50em;
}
</style>
<template>
<link rel="stylesheet" href="custom-pie-chart.css">
<div id="chartdiv">
<google-chart
type='pie'
options='{"title": "Distribution of days in 2001Q1"}'
cols='[{"label":"Month", "type":"string"}, {"label":"Days", "type":"number"}]'
rows='[["Jan", 31],["Feb", 28],["Mar", 31]]'> …Run Code Online (Sandbox Code Playgroud)polymer-1.0 ×5
polymer ×4
wordpress ×3
c# ×2
javascript ×2
amazon-ec2 ×1
apache ×1
arrays ×1
asp.net ×1
asp.net-core ×1
c#-4.0 ×1
dnu ×1
json ×1
json.net ×1
pie-chart ×1
sql-server ×1
ubuntu-16.04 ×1
user-roles ×1
vue.js ×1
vuex ×1