C# 但是?只是一个猜测,但是试着把它设置为“pessoaId”?@SvenGrosen我会读的,谢谢你的提示。关于钥匙,我试过了,但还是有同样的错误,不过还是谢谢你。这不是问题所在。问题是Coletor类需要一个pessoaId才能成为Pessoa类中的另一个
C# 但是?只是一个猜测,但是试着把它设置为“pessoaId”?@SvenGrosen我会读的,谢谢你的提示。关于钥匙,我试过了,但还是有同样的错误,不过还是谢谢你。这不是问题所在。问题是Coletor类需要一个pessoaId才能成为Pessoa类中的另一个,c#,linq,windows-phone-8,linq-to-sql,C#,Linq,Windows Phone 8,Linq To Sql,但是?只是一个猜测,但是试着把它设置为“pessoaId”?@SvenGrosen我会读的,谢谢你的提示。关于钥匙,我试过了,但还是有同样的错误,不过还是谢谢你。这不是问题所在。问题是Coletor类需要一个pessoaId才能成为Pessoa类中的另一个键。无论如何,谢谢你。 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.Linq.M
但是?只是一个猜测,但是试着把它设置为“pessoaId”?@SvenGrosen我会读的,谢谢你的提示。关于钥匙,我试过了,但还是有同样的错误,不过还是谢谢你。这不是问题所在。问题是Coletor类需要一个pessoaId才能成为Pessoa类中的另一个键。无论如何,谢谢你。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq.Mapping;
using System.Data.Linq;
namespace Aplicativo_Windows_Phone
{
#pragma warning disable 0169, 0649
[Table(Name="Pessoas")]
public class Pessoa
{
[Column(IsDbGenerated = true, IsPrimaryKey = true)]
public int Id { get; set; }
[Column]
public string Nome { get; set; }
[Column]
public string Email { get; set; }
[Column]
public string Senha { get; set; }
[Column]
public string Profissao { get; set; }
[Column]
public int Idade { get; set; }
[Column]
public string Endereco { get; set; }
[Column]
public string Cidade { get; set; }
[Column]
public string Estado { get; set; }
[Column(IsPrimaryKey = true, Name = "Coletor")]
private int? coletorId;
private EntityRef<Coletor> _coletor = new EntityRef<Coletor>();
[Association(Name = "FK_Pessoas_PessoaColetores", IsForeignKey = true, Storage = "_coletor", ThisKey = "coletorId")]
public Coletor Coletor
{
get { return _coletor.Entity; }
set { _coletor.Entity = value; }
}
private EntitySet<PessoaColetor> _pessoaColetores = new EntitySet<PessoaColetor>();
[Association(Name = "FK_PessoaColetores_Pessoa", Storage = "_pessoaColetores", OtherKey = "pessoaId", ThisKey = "Id")]
private ICollection<PessoaColetor> PessoaColetores
{
get { return _pessoaColetores; }
set { _pessoaColetores.Assign(value); }
}
public ICollection<Coletor> Coletores
{
get { return (from pc in PessoaColetores select pc.Coletor).ToList(); }
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq.Mapping;
using System.Data.Linq;
using Microsoft.Phone.Data.Linq;
using Microsoft.Phone.Data.Linq.Mapping;
namespace Aplicativo_Windows_Phone
{
#pragma warning disable 0169, 0649
[Table(Name="Coletores")]
public class Coletor
{
[Column(IsPrimaryKey = true, IsDbGenerated = true)]
public int Id { get; set; }
[Column]
public float Latitude { get; set; }
[Column]
public float Longitude { get; set; }
[Column]
public string Nome { get; set; }
private EntitySet<PessoaColetor> _pessoaColetores = new EntitySet<PessoaColetor>();
[Association(Name = "FK_PessoaColetores_Coletor", Storage = "_pessoaColetores", ThisKey = "Id", OtherKey = "coletorId")]
private ICollection<PessoaColetor> PessoaColetores
{
get { return _pessoaColetores; }
set { _pessoaColetores.Assign(value); }
}
[Column(IsPrimaryKey = true, Name = "Ocorrencias")]
private int? ocorrenciaId;
private EntityRef<Ocorrencia> _ocorrencia = new EntityRef<Ocorrencia>();
[Association(Name = "FK_Coletores_ColetorOcorrencias", IsForeignKey = true, Storage = "_ocorrencia", ThisKey = "ocorrenciaId")]
public Ocorrencia Ocorrencia
{
get { return _ocorrencia.Entity; }
set { _ocorrencia.Entity = value; }
}
private EntitySet<ColetorOcorrencia> _coletorOcorrencias = new EntitySet<ColetorOcorrencia>();
[Association(Name = "FK_ColetorOcorrencias_Coletor", Storage = "_coletorOcorrencias",ThisKey = "Id", OtherKey = "coletorId")]
private ICollection<ColetorOcorrencia> ColetorOcorrencias
{
get { return _coletorOcorrencias; }
set { _coletorOcorrencias.Assign(value); }
}
public ICollection<Pessoa> Pessoas
{
get { return (from pc in PessoaColetores select pc.Pessoa).ToList(); }
}
public ICollection<Ocorrencia> Ocorrencias
{
get { return (from co in ColetorOcorrencias select co.Ocorrencia).ToList(); }
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq.Mapping;
using System.Data.Linq;
using Microsoft.Phone.Data.Linq;
using Microsoft.Phone.Data.Linq.Mapping;
namespace Aplicativo_Windows_Phone
{
#pragma warning disable 0169, 0649
[Table(Name = "PessoaColetores")]
class PessoaColetor
{
[Column(IsPrimaryKey = true, Name = "Coletor")]
private int coletorId;
private EntityRef<Coletor> _coletor = new EntityRef<Coletor>();
[Association(Name = "FK_PessoaColetores_Coletores", IsForeignKey = true, Storage = "_coletor", ThisKey = "coletorId")]
public Coletor Coletor
{
get { return _coletor.Entity; }
set { _coletor.Entity = value; }
}
[Column(IsPrimaryKey = true, Name = "Pessoa")]
private int pessoaId;
private EntityRef<Pessoa> _pessoa = new EntityRef<Pessoa>();
[Association(Name = "FK_PessoaColetores_Pessoas", IsForeignKey = true, Storage = "_pessoa", ThisKey = "pessoaId")]
public Pessoa Pessoa
{
get { return _pessoa.Entity; }
set { _pessoa.Entity = value; }
}
}
}
[Column(IsPrimaryKey = true, Name = "Coletor")]
private int? coletorId;
[Column(IsForeignKey= true, Name = "Coletor")]
private int? coletorId;