我想跳过ng-repeat中的第一项
..first item here
<ul class="highlight-topright">
<li ng-repeat="item in hpHeadlines | filter:$index>0">
...
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
它不起作用,这里有什么不对吗?
据我所知,我可以使用ng-if,ng-show隐藏内容,但我无法理解为什么在这种情况下过滤器在1.3.x中不起作用.
谢谢.
我是aspcore的新手,我试过了
nuget dapper
nuget MicroOrm.Pocos.SqlGenerator
Run Code Online (Sandbox Code Playgroud)
我想用自己的编译替换其中一个dll但不知道把它放在哪里.
Dependencies文件夹不显示任何内容.
我使用SQL Server SMO将.bak还原到新数据库,但无法正常工作.
sql server是2012,smo对象版本来自最新的sdk版本11.0
文件.bak是使用sql management studio 2012,相同的本地pc,在同一个编码的PC上创建的.
我得到的错误信息是:
服务器'SERVER'的恢复失败.
我的代码出了什么问题?
string dbPath = Path.Combine(@"d:\my data", dbName + "_db" + ".mdf");
string logPath = Path.Combine(@"d:\my data", dbName + "_db" + "_Log.ldf");
Restore restore = new Restore();
BackupDeviceItem deviceItem = new BackupDeviceItem("d:\template.BAK", DeviceType.File);
restore.Devices.Add(deviceItem);
restore.Database = dbName + "_db";
RelocateFile relocateDataFile = new RelocateFile("Data", dbPath);
RelocateFile relocateLogFile = new RelocateFile("Log", logPath);
restore.RelocateFiles.Add(relocateDataFile);
restore.RelocateFiles.Add(relocateLogFile);
restore.Action = RestoreActionType.Database;
restore.ReplaceDatabase = true;
restore.SqlRestore(server);
Run Code Online (Sandbox Code Playgroud)
更新:我放弃了SMO解决方案,并尝试过
using (SqlConnection connection = new SqlConnection("Data Source=server;user id=sa;password=xxxxx;"))
{ …Run Code Online (Sandbox Code Playgroud) 这是我第一次使用Dapper.Contrib(Nuget的最新版本),这是一个奇怪的情况:
using (SqlConnection cn = new SqlConnection(connectionString))
{
cn.Open();
var product = cn.Get<Product>(1);
}
Run Code Online (Sandbox Code Playgroud)
在SqlMapperExtensions上,它引发了错误Invalid object name 'Products':
public static T Get<T>(this IDbConnection connection,
dynamic id,
IDbTransaction transaction = null,
int? commandTimeout = null) where T : class
{
var type = typeof(T);
string sql;
if (!GetQueries.TryGetValue(type.TypeHandle, out sql))
}
Run Code Online (Sandbox Code Playgroud)
数据库收到select * from Products where Id = @id错误的命令.
s到产品?我已尝试过其他表并获得相同的结果.
我有一个桌子队
Id Name ...
1 Chelsea
2 Arsenal
3 Liverpool
Run Code Online (Sandbox Code Playgroud)
现在我需要搜索我的队桌是否有像"切尔西足球俱乐部"这样的名字.在这种情况下,当搜索字符串可能有额外的单词时,如何进行选择查询?
我可以尝试使用Lucene.net,但这只是一个小的用途,它有点过分,需要时间来学习它.
我正在尝试使用webclient下载网页并获取500内部错误
public class AsyncWebClient
{
public string GetContent(string url)
{
return GetWebContent(url).Result.ToString();
}
private Task<string> GetWebContent(string url)
{
var wc = new WebClient();
TaskCompletionSource<string> tcs = new TaskCompletionSource<string>();
wc.DownloadStringCompleted += (obj, args) =>
{
if (args.Cancelled == true)
{
tcs.TrySetCanceled();
return;
}
if (!String.IsNullOrEmpty(args.Result))
tcs.TrySetResult(args.Result);
};
wc.DownloadStringAsync(new Uri(url));
return tcs.Task;
}
}
Run Code Online (Sandbox Code Playgroud)
并致电:
var wc =new AsyncWebClient();
var html = wc.GetContent("http://truyen.vnsharing.net/"); >> always get the above error
Run Code Online (Sandbox Code Playgroud)
如果我使用其他网站,那么它的工作正常.不知道这个网站有什么特别之处.
请帮忙 !!
我遵循ASP.NET Core 中的通用存储库模式,但在IRepository,我使用IQueryable而不是IEnumerable:
public interface IRepository<T> where T: BaseEntity
{
IQueryable<T> Table { get; }
IEnumerable<T> TableNoTracking { get; }
T Get(long id);
void Insert(T entity);
void Update(T entity);
void Delete(T entity);
}
Run Code Online (Sandbox Code Playgroud)
和实现类:
public class EFRepository<T> : IRepository<T> where T : BaseEntity
{
private readonly ApplicationDbContext _ctx;
private DbSet<T> entities;
string errorMessage = string.Empty;
public EFRepository(ApplicationDbContext context)
{
this._ctx = context;
entities = context.Set<T>();
}
public virtual IQueryable<T> Table => this.entities; …Run Code Online (Sandbox Code Playgroud) 我使用.net 4.0,我试图弄清楚如何使用异步方法来等待DocumentCompleted事件完成并返回值.我的原始代码在上面,如何在这种情况下将其转换为异步/等待模型?
private class BrowserWindow
{
private bool webBrowserReady = false;
public string content = "";
public void Navigate(string url)
{
xxx browser = new xxx();
browser.DocumentCompleted += new EventHandler(wb_DocumentCompleted);
webBrowserReady = false;
browser.CreateControl();
if (browser.IsHandleCreated)
browser.Navigate(url);
while (!webBrowserReady)
{
//Application.DoEvents(); >> replace it with async/await
}
}
private void wb_DocumentCompleted(object sender, EventArgs e)
{
try
{
...
webBrowserReady = true;
content = browser.Document.Body.InnerHtml;
}
catch
{
}
}
public delegate string AsyncMethodCaller(string url);
}
Run Code Online (Sandbox Code Playgroud) 我使用Selenium和Phantomjs,并希望在页面完全加载后获取页面内容.
我试过http://docs.seleniumhq.org/docs/04_webdriver_advanced.jsp,但似乎无法使用phantomjs
明确的等待:
using (IWebDriver driver = new PhantomJSDriver())
{
IWait<IWebDriver> wait = new OpenQA.Selenium.Support.UI.WebDriverWait(driver, TimeSpan.FromSeconds(30.00));
wait.Until(driver1 => ((IJavaScriptExecutor)driver).ExecuteScript("return document.readyState").Equals("complete"));
driver.Navigate().GoToUrl(url);
content = driver.PageSource;
driver.Quit();
}
Run Code Online (Sandbox Code Playgroud)
另一个测试:
using (IWebDriver driver = new PhantomJSDriver())
{
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
driver.Url = url;
IWebElement myDynamicElement = wait.Until<IWebElement>((d) =>
{
return d.FindElement(By.Id("footer")); // failed because it's not yet loaded full content
});
content = driver.PageSource;
}
Run Code Online (Sandbox Code Playgroud)
或隐含等待:
using (IWebDriver driver = new PhantomJSDriver())
{
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(30));
driver.Navigate().GoToUrl(url);
content = driver.PageSource; …Run Code Online (Sandbox Code Playgroud) ALTER PROCEDURE [dbo].[SearchMovies]
--@Year int = null,
@CategoryIds varchar(50) = null,
@Keywords nvarchar(4000) = null,
@PageIndex int = 1,
@PageSize int = 2147483644,
@TotalRecords int = null OUTPUT
As ...
Run Code Online (Sandbox Code Playgroud)
EF存储库:
public class EFRepository<T> : IRepository<T> where T : BaseEntity
{
private readonly ApplicationDbContext _ctx;
private DbSet<T> entities;
string errorMessage = string.Empty;
public EFRepository(ApplicationDbContext context)
{
this._ctx = context;
entities = context.Set<T>();
}
...
public IQueryable<T> ExecuteStoredProcedureList(string commandText, params object[] parameters)
{
_ctx.Database.ExecuteSqlCommand(commandText, parameters);
return entities.FromSql(commandText, parameters);
}
}
Run Code Online (Sandbox Code Playgroud)
我称之为: …
c# asp.net-mvc entity-framework entity-framework-core asp.net-core
c# ×8
asp.net-mvc ×2
sql-server ×2
.net ×1
angularjs ×1
asp.net ×1
asp.net-core ×1
asynchronous ×1
dapper ×1
nuget ×1
phantomjs ×1
selenium ×1
smo ×1
sql ×1
webclient ×1