J'ai la structure suivante pour une tableSubsonic 3.0.0.3 obtenir des éléments distincts sur le nom de la colonne. ActiveRecord
CREATE TABLE [dbo].[CityDistancesMin](
[Id] int identity(1,1) not null,
[City1] [int] NOT NULL,
[City2] [int] NOT NULL,
[Car] [nvarchar](50) NOT NULL,
[Distance] [int] NOT NULL,
CONSTRAINT [PK_CityDistancesMin] PRIMARY KEY CLUSTERED
(
[Id] ASC
) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
Et je besoin d'un moyen d'obtenir différentes Ids des villes SubSonic 3.0.0.3. Par exemple, sur sql il ne serait qu'un Select distinct City1 from CityDistancesMin
je tentais de faire ce qui suit
SqlQuery query = new Select(CityDistancesMinTable.City1Column)
.From< CityDistancesMinTable>();
query.Aggregates = new List<Aggregate> {
new Aggregate(CityDistancesMinTable.City1Column, AggregateFunction.GroupBy)
};
Mais je reçois l'erreur suivante:
Can't decide which property to consider the Key - you can create one called 'ID' or mark one with SubSonicPrimaryKey attribute"
J'ai essayé renommage Id
à ID
mais cela ne semble pas aider.