小编omn*_*nir的帖子

使用SQLite-Net Extensions和OneToMany关系

我在尝试为Windows Phone 8.1实现具有OneToMany关系的SQLite-Extensions示例时遇到了困难.我真的很想使用这个功能,但是我正在试着让它发挥作用.就像在这个问题中一样,当我尝试将提供的示例用于具有Valuations列表的Stocks表时:

public class Stock
{
    [PrimaryKey, AutoIncrement]
    public int Id { get; set; }
    [MaxLength(8)]
    public string Symbol { get; set; }

    [OneToMany(CascadeOperations = CascadeOperation.All)]      // One to many relationship with Valuation
    public List<Valuation> Valuations { get; set; }
}

public class Valuation
{
    [PrimaryKey, AutoIncrement]
    public int Id { get; set; }

    [ForeignKey(typeof(Stock))]     // Specify the foreign key
    public int StockId { get; set; }
    public DateTime Time { get; set; }
    public …
Run Code Online (Sandbox Code Playgroud)

c# sqlite sqlite-net windows-phone-8.1 sqlite-net-extensions

6
推荐指数
1
解决办法
3862
查看次数

为可移植类库创建NuGet包时出错

我是Nuget的新手,我正在尝试为可移植类库项目创建一个NuGet包,它对我创建的另一个可移植类库具有包依赖性.

我遇到了一个问题,我在调用项目文件TestComponent2.csproj的nuget包时收到错误(我是在VS 2013中的Portable for Universal Apps模板中创建的).该库依赖于从另一个名为TestComponent1的 PCL创建的nuget包.

创建的包似乎从未包含此依赖项(控制台输出甚至表示"依赖项:无").但是,在TestComponent2项目的packages.config文件中,肯定列出了依赖项:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="TestComponent1" version="1.0" targetFramework="portable-win81+wpa81" />
</packages>
Run Code Online (Sandbox Code Playgroud)

所以在我的情况下,我从名为TestComponent2的项目的命令行中调用以下内容,从包含TestComponent2.csproj和packages.config的文件夹中打开详细信息:

> nuget pack TestComponent2.csproj -Verbosity Detailed
Run Code Online (Sandbox Code Playgroud)

警告:无法从"TestComponent2.dll"中提取元数据.警告:System.IO.FileNotFoundException:无法加载文件或程序集'System.Runtime,Version = 4.0.10.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'或其依赖项之一.该系统找不到指定的文件.文件名:'System.Runtime,Version = 4.0.10.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'---> System.IO.FileNotFoundException:无法加载文件或程序集'System.Runtime,Version = 4.0.10.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'或其依赖项之一.该系统找不到指定的文件.文件名:'System.Runtime,Version = 4.0.10.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'in System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,Boolean System.Reflection.RuntimeAssembly.nLoad中的throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,B oolean suppressSecurityChecks)

...

将文件'mypath\TestComponent2.dll'添加到'lib\portable-win81 + wpa81\TestComponent2.dll'包中

找到packages.config.使用列为依赖项的包 …

.net nuget portable-class-library visual-studio-2013 win-universal-app

5
推荐指数
2
解决办法
1619
查看次数