c# - “使用 SQLite;” 变灰
问题描述
我正在做一个多平台的 xamarin 表单项目。我正在为数据库使用 SQLite。我安装了“sqlite-net pcl”nuget。我在主应用程序中创建了一个模型类
using System;
using System.Collections.Generic;
using System.Text;
using SQLite;
namespace MyApp.Models
{
[Table("vegetables")]
public class Vegetable
{
[PrimaryKey, AutoIncrement]
public int VegetableId { get; set; }
[MaxLength (250), Unique]
public string VegetableName { get; set; }
}
}
使用 SQLite;是灰色的,Visual Studio 说没有必要包含它。通常,当您键入 [Table("vegetables")] 时,“Table”会变为蓝色,表示它是 TableAttribute。在我的代码表中,PrimaryKey 等保持黑色,似乎没有任何关联。
我正在关注我从教科书中所做的示例项目,它在示例中工作,我对我的代码执行相同的步骤,但遇到了这个问题。我错过了什么?
解决方案
推荐阅读
- amazon-web-services - 如何在不删除现有内容的情况下向 AWS Lambda 添加环境变量?
- javascript - material-ui 点击一个时关闭所有其他卡片内容
- c# - Asp.Net Mvc Identity&Owin 真正的双重身份验证方式
- swift - 如何将 NSDateComponent 作为函数参数传递
- typescript - 你如何在类型 T 和 U 上声明一个函数泛型,它不允许 T 和 U 的空交集
- python - 来自单个 CSV 文件源的多个列表推导
- python - mysql工作台无法导入pyodbc
- javascript - 内容安全策略 jQuery 加载 PHP Echo Nonce
- sql - 在 mySQL 工作台中创建过程语句时出现错误 1064
- excel - Remove the commas, spaces and "NULL" string to 0(Zero) from Column