当前位置: 首页>>代码示例>>C#>>正文


C# MappingConfiguration.HasAssociation方法代码示例

本文整理汇总了C#中MappingConfiguration.HasAssociation方法的典型用法代码示例。如果您正苦于以下问题:C# MappingConfiguration.HasAssociation方法的具体用法?C# MappingConfiguration.HasAssociation怎么用?C# MappingConfiguration.HasAssociation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MappingConfiguration的用法示例。


在下文中一共展示了MappingConfiguration.HasAssociation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateQuestionMapping

        private MappingConfiguration<Question> CreateQuestionMapping()
        {
            MappingConfiguration<Question> questionMapping = new MappingConfiguration<Question>();
            questionMapping.MapType(question => new
            {
                QuestionId = question.Id,
                QueryText = question.QueryText,
                PostedById = question.PostedById
            })
            .ToTable("Questions");
            questionMapping.HasProperty(q => q.Id).IsIdentity();
            questionMapping.HasAssociation(q => q.PostedBy)
                .WithOpposite(u => u.CreatedQuestions)
                .HasConstraint((q, u) => q.PostedById == u.Id);
            questionMapping.HasAssociation(q => q.UsersThatVoted)
                .WithOpposite(u => u.VotedOnQuestions)
                .IsManaged()
                .MapJoinTable("QuestionsUsers", (q, u) => new 
                    {
                        QuestionGuid = q.Id,
                        UserGuid = u.Id
                    });
            questionMapping.HasAssociation(q => q.Answers)
                .WithOpposite(a => a.Question)
                .HasConstraint((q, a) => q.Id == a.QuestionId)
                .IsManaged();

            return questionMapping;
        }
开发者ID:BPalagachev,项目名称:PollSystem,代码行数:29,代码来源:IdentityModelMetadataSource.cs

示例2: TeamMapping

        private MappingConfiguration TeamMapping()
        {
            var mapping = new MappingConfiguration<Team>();

            mapping.MapType()
                   .ToTable("Team");

            mapping.HasProperty(m => m.Id)
                   .IsIdentity(KeyGenerator.Autoinc);

            mapping.HasProperty(m => m.IsOpen)
                   .HasColumnType("bit");

            mapping.HasAssociation(m => m.Owner)
                   .IsManaged()
                   .ToColumn("OwnerId");

            mapping.HasAssociation(m => m.Things)
                   .IsManaged()
                   .ToColumn("TeamId");

            mapping.HasAssociation(m => m.Members)
                   .WithOpposite(t => t.Team)
                   .IsManaged()
                   .IsDependent()
                   .ToColumn("TeamId");

            return mapping;
        }
开发者ID:jessemlay,项目名称:TeamThing,代码行数:29,代码来源:TeamThingMetadataSource.cs

示例3: MapItem

        private void MapItem(IList<MappingConfiguration> mappings)
		{
			var itemMapping = new MappingConfiguration<ProductItem>();
            itemMapping.HasProperty(p => p.Id).IsIdentity();
			itemMapping.MapType(p => new { }).ToTable("custom_products");
            itemMapping.HasProperty(p => p.Price);
            itemMapping.HasProperty(p => p.QuantityInStock);
			itemMapping.HasAssociation<Telerik.Sitefinity.Security.Model.Permission>(p => p.Permissions);
			itemMapping.HasProperty(p => p.InheritsPermissions);
			itemMapping.HasProperty(p => p.CanInheritPermissions);
            itemMapping.HasAssociation(p => p.Urls).WithOppositeMember("parent","Parent").ToColumn("content_id").IsDependent().IsManaged();

			//map language data & published translations
			CommonFluentMapping.MapILifecycleDataItemFields<ProductItem>(itemMapping, this.Context);
			mappings.Add(itemMapping);
		}
开发者ID:jrcollado1987,项目名称:Telerik.Sitefinity.Samples.Products,代码行数:16,代码来源:ProductsFluentMapping.cs

示例4: PrepareDataAccessCountryAssociationConfigurations

 public void PrepareDataAccessCountryAssociationConfigurations(MappingConfiguration<DataAccessCountry> configuration)
 {
     configuration.HasAssociation(x => x.DataAccessDealers)
                  .HasFieldName("dataAccessDealers")
                  .WithOpposite(x => x.DataAccessCountry)
                  .ToColumn("CountryId")
                  .HasConstraint((y, x) => x.CountryId == y.Id)
                  .WithDataAccessKind(DataAccessKind.ReadWrite);
 }
开发者ID:kalinalazarova1,项目名称:TeamGiant-DatabaseProject,代码行数:9,代码来源:VehicleVendorCustomMetadataSource.cs

示例5: MapItem

        private void MapItem(IList<MappingConfiguration> mappings)
        {
            var itemMapping = new MappingConfiguration<AgentItem>();
            itemMapping.HasProperty(p => p.Id).IsIdentity();
            itemMapping.MapType(p => new { }).ToTable("sfex_agent_item");

            itemMapping.HasProperty(p => p.Email);
            itemMapping.HasProperty(p => p.PhoneNumber);
            itemMapping.HasProperty(p => p.Address);
            itemMapping.HasProperty(p => p.PostalCode);

            itemMapping.HasAssociation<Telerik.Sitefinity.Security.Model.Permission>(p => p.Permissions);
            itemMapping.HasProperty(p => p.InheritsPermissions);
            itemMapping.HasAssociation<Telerik.Sitefinity.Security.Model.PermissionsInheritanceMap>(p => p.PermissionChildren);
            itemMapping.HasProperty(p => p.CanInheritPermissions);
            itemMapping.HasAssociation(p => p.Urls).WithOppositeMember("parent", "Parent").ToColumn("content_id").IsDependent().IsManaged();
            CommonFluentMapping.MapILifecycleDataItemFields<AgentItem>(itemMapping, this.Context);

            mappings.Add(itemMapping);
        }
开发者ID:jrcollado1987,项目名称:Telerik.Sitefinity.Samples.RealEstate,代码行数:20,代码来源:AgentsFluentMapping.cs

示例6: PrepareMapping

		protected override IList<MappingConfiguration> PrepareMapping()
		{
			List<MappingConfiguration> mappingConfigurations = new List<MappingConfiguration>();

            MappingConfiguration<Vendor> vendorConfiguration = new MappingConfiguration<Vendor>();
            vendorConfiguration.MapType(v => new
            {
                VendorId = v.Id,
                VendorName = v.Name,
            }).ToTable("Vendors");
            vendorConfiguration.HasProperty(v => v.Id).IsIdentity();

            MappingConfiguration<Measure>measureConfiguration = new MappingConfiguration<Measure>();
            measureConfiguration.MapType(m => new
            {
                MeasureId = m.Id,
                MeasureName = m.Name,
            }).ToTable("Measures");
            measureConfiguration.HasProperty(m => m.Id).IsIdentity();

            MappingConfiguration<Product> productConfiguration = new MappingConfiguration<Product>();
            productConfiguration.MapType(p => new
            {
                ProductId = p.Id,
                ProductName = p.Name,
                VendorId=p.VendorId,
                MeasureId=p.MeasureId,
                BasePrice=p.BasePrice
            }).ToTable("Products");
            productConfiguration.HasProperty(p => p.Id).IsIdentity();

            productConfiguration.HasAssociation(p => p.Vendor).ToColumn("VendorId");

            productConfiguration.HasAssociation(p => p.Measure).ToColumn("MeasureId");

            mappingConfigurations.Add(productConfiguration);
            mappingConfigurations.Add(vendorConfiguration);
            mappingConfigurations.Add(measureConfiguration);

			return mappingConfigurations;
		}
开发者ID:psotirov,项目名称:TelerikAcademyProjects,代码行数:41,代码来源:SupermarketDataMetadataSource.cs

示例7: TeamUserMapping

        private MappingConfiguration TeamUserMapping()
        {
            var mapping = new MappingConfiguration<TeamUser>();

            mapping.MapType()
                   .ToTable("TeamUser");

            mapping.HasIdentity(map => new
            {
                map.UserId,
                map.TeamId,
            });

            mapping.HasAssociation(m => m.Team)
                   .WithOpposite(t => t.Members)
                   .IsManaged()
                   .IsDependent()
                   .ToColumn("TeamId");

            mapping.HasAssociation(m => m.User)
                   .WithOpposite(t => t.Teams)
                   .IsManaged()
                   .IsDependent()
                   .ToColumn("UserId");

            mapping.HasProperty(m => m.Status)
                   .HasColumnType("varchar")
                   .HasPrecision(25)
                   .WithConverter<EnumToStringConverter<TeamUserStatus>>();

            mapping.HasProperty(m => m.Role)
                   .HasColumnType("varchar")
                   .HasPrecision(25)
                   .WithConverter<EnumToStringConverter<TeamUserRole>>();

            return mapping;
        }
开发者ID:jessemlay,项目名称:TeamThing,代码行数:37,代码来源:TeamThingMetadataSource.cs

示例8: MapItem

        /// <summary>
        /// Maps the ProjectItem class.
        /// </summary>
        /// <param name="mappings">The ProjectItem class mappings.</param>
        private void MapItem(IList<MappingConfiguration> mappings)
        {
            // initialize mapping
            var itemMapping = new MappingConfiguration<ProjectItem>();
            itemMapping.HasProperty(p => p.Id).IsIdentity();
            itemMapping.MapType(p => new { }).ToTable("sf_Projects");

            // add properties
            itemMapping.HasProperty(p => p.Address);
            itemMapping.HasProperty(p => p.City);
            itemMapping.HasProperty(p => p.Region).IsNullable();
            itemMapping.HasProperty(p => p.PostalCode);
            itemMapping.HasProperty(p => p.Country);

            // map urls table association
            itemMapping.HasAssociation(p => p.Urls).WithOppositeMember("parent", "Parent").ToColumn("content_id").IsDependent().IsManaged();
            mappings.Add(itemMapping);
        }
开发者ID:eulalie367,项目名称:littleapps,代码行数:22,代码来源:FluentMapping.cs

示例9: ThingMapping

        private MappingConfiguration ThingMapping()
        {
            var mapping = new MappingConfiguration<Thing>();

            mapping.MapType()
                   .ToTable("Thing");

            mapping.HasProperty(m => m.Id)
                   .IsIdentity(KeyGenerator.Autoinc);

            mapping.HasProperty(m => m.IsDeleted)
                   .HasColumnType("bit");

            //mapping.HasProperty(m => m.IsStarred)
            //       .HasColumnType("bit");

            mapping.HasAssociation(m => m.AssignedTo)
                   .WithOpposite(t => t.Thing)
                   .IsManaged()
                   .IsDependent();

            mapping.HasAssociation(m => m.History)
                   .WithOpposite(tl => tl.Thing)
                   .IsManaged()
                   .IsDependent();

            mapping.HasAssociation(m => m.Owner)
                   .IsManaged()
                   .ToColumn("OwnerId");

            mapping.HasAssociation(m => m.Team)
                   .WithOpposite(m => m.Things)
                   .ToColumn("TeamId");

            mapping.HasProperty(m => m.Status)
                   .HasColumnType("varchar")
                   .HasPrecision(25)
                   .WithConverter<EnumToStringConverter<ThingStatus>>();

            return mapping;
        }
开发者ID:jessemlay,项目名称:TeamThing,代码行数:41,代码来源:TeamThingMetadataSource.cs

示例10: ThingLogMapping

        private MappingConfiguration ThingLogMapping()
        {
            var mapping = new MappingConfiguration<ThingLog>();

            mapping.MapType()
                  .ToTable("ThingLog");

            mapping.HasProperty(m => m.Id)
                   .IsIdentity(KeyGenerator.Autoinc);

            mapping.HasProperty(m => m.EditedByUserId)
                   .ToColumn("EditedByUserId");

            mapping.HasProperty(m => m.ThingId)
                   .ToColumn("ThingId");

            mapping.HasAssociation(m => m.Thing)
                  .WithOpposite(m => m.History)
                  .IsManaged()
                  .IsDependent()
                  .IsRequired()
                  .ToColumn("ThingId");

            mapping.HasAssociation(m => m.EditedBy)
                   .WithOpposite(u => u.ThingLog)
                   .IsManaged()
                   .IsDependent()
                   .IsRequired()
                   .ToColumn("EditedByUserId");

            mapping.HasProperty(m => m.Action)
                   .HasColumnType("varchar")
                   .HasPrecision(25)
                   .WithConverter<EnumToStringConverter<ThingAction>>();

            return mapping;
        }
开发者ID:jessemlay,项目名称:TeamThing,代码行数:37,代码来源:TeamThingMetadataSource.cs

示例11: UserMapping

        private MappingConfiguration UserMapping()
        {
            var mapping = new MappingConfiguration<User>();

            mapping.MapType()
                  .ToTable("User");

            mapping.HasProperty(m => m.Id)
                   .IsIdentity(KeyGenerator.Autoinc);

            mapping.HasProperty(m => m.IsActive)
                   .HasColumnType("bit");

            mapping.HasAssociation(m => m.Things)
                   .WithOpposite(m => m.AssignedToUser)
                   .IsManaged()
                   .ToColumn("AssignedToUserId");
            mapping.HasAssociation(m => m.Teams)
                   .WithOpposite(t => t.User)
                   .IsManaged()
                   .IsDependent()
                   .ToColumn("UserId");
            return mapping;
        }
开发者ID:Go9Rhodes,项目名称:TeamThing,代码行数:24,代码来源:TeamThingMetadataSource.cs

示例12: PrepareMapping

        protected override IList<MappingConfiguration> PrepareMapping()
        {
            List<MappingConfiguration> configuracionesMap = new List<MappingConfiguration>();

            MappingConfiguration<Persona> PersonaConfiguration = new MappingConfiguration<Persona>();
            PersonaConfiguration.MapType().ToTable("PERSONAS");
            PersonaConfiguration.HasProperty(c => c.PersonaId).IsIdentity(KeyGenerator.Autoinc);
            PersonaConfiguration.
                HasAssociation(prop => prop.Propiedades).WithOpposite(pers => pers.Persona).HasConstraint((pers, prop) => pers.PersonaId == prop.PersonaId);
            PersonaConfiguration.
                HasAssociation(pers => pers.Contratos).WithOpposite(pers => pers.Persona).HasConstraint((pers, prop) => pers.PersonaId == prop.PersonaId);
            configuracionesMap.Add(PersonaConfiguration);

            MappingConfiguration<Propiedad> PropiedadesConfiguration = new MappingConfiguration<Propiedad>();
            PropiedadesConfiguration.MapType().ToTable("PROPIEDADES");
            PropiedadesConfiguration.HasProperty(c => c.PropiedadId).IsIdentity(KeyGenerator.Autoinc);
            PropiedadesConfiguration.
                HasAssociation(prop => prop.Comuna).WithOpposite(c => c.Propiedades).HasConstraint((prop, c) => prop.ComunaId == c.Id);
            PropiedadesConfiguration.
                HasAssociation(prop => prop.Region).WithOpposite(r => r.Propiedades).HasConstraint((prop, r) => prop.RegionId == r.RegionId);
            PropiedadesConfiguration.
                HasAssociation(prop => prop.ConjuntoHabitacional).WithOpposite(conHab => conHab.Propiedades).HasConstraint((p, conHab) => p.ConjuntoHabitacionalId == conHab.ConjuntoHabitacionalId);
            PropiedadesConfiguration.
                HasAssociation(prop => prop.ServiciosDeMantenciones).WithOpposite(sm => sm.Propiedad).HasConstraint((prop, sw) => prop.PropiedadId == sw.PropiedadId);
            PropiedadesConfiguration.
                HasAssociation(prop => prop.Contratos).WithOpposite(c => c.Propiedad).HasConstraint((prop, c) => prop.PropiedadId == c.PropiedadId);
            configuracionesMap.Add(PropiedadesConfiguration);

            MappingConfiguration<Contrato> ContratoConfiguration = new MappingConfiguration<Contrato>();
            ContratoConfiguration.MapType().ToTable("CONTRATOS");
            ContratoConfiguration.HasProperty(c => c.ContratoId).IsIdentity(KeyGenerator.Autoinc);
            ContratoConfiguration.
                HasAssociation(c => c.Pagos).WithOpposite(pago => pago.Contrato).HasConstraint((c, pago) => c.ContratoId == pago.ContratoId);
            ContratoConfiguration.
                HasAssociation(c => c.Documentos).WithOpposite(d => d.Contrato).HasConstraint((c, d) => c.ContratoId == d.ContratoId);
            configuracionesMap.Add(ContratoConfiguration);

            MappingConfiguration<Notaria> NotariaConfiguration = new MappingConfiguration<Notaria>();
            NotariaConfiguration.MapType().ToTable("NOTARIAS");
            NotariaConfiguration.HasProperty(n => n.NotariaId).IsIdentity(KeyGenerator.Autoinc);
            NotariaConfiguration.
                HasAssociation(n => n.Contratos).WithOpposite(c => c.Notaria).HasConstraint((n, c) => n.NotariaId == c.NotariaId);
            configuracionesMap.Add(NotariaConfiguration);

            MappingConfiguration<ConservadorBienRaiz> ConservadorBienRaizConfiguration = new MappingConfiguration<ConservadorBienRaiz>();
            ConservadorBienRaizConfiguration.MapType().ToTable("CBRS");
            ConservadorBienRaizConfiguration.HasProperty(cbr => cbr.ConservadorBienRaizId).IsIdentity(KeyGenerator.Autoinc);
            ConservadorBienRaizConfiguration.
                HasAssociation(cbr => cbr.Contratos).WithOpposite(c => c.ConservadorBienRaiz).HasConstraint((cbr, c) => cbr.ConservadorBienRaizId == c.ConservadorBienRaizId);
            configuracionesMap.Add(ConservadorBienRaizConfiguration);

            MappingConfiguration<Convenio> ConvenioConfiguration = new MappingConfiguration<Convenio>();
            ConvenioConfiguration.MapType().ToTable("CONVENIOS");
            ConvenioConfiguration.HasProperty(c => c.ConvenioId).IsIdentity(KeyGenerator.Autoinc);
            ConvenioConfiguration.
                HasAssociation(c => c.Contratos).WithOpposite(contrato => contrato.Convenio).HasConstraint((c, contrato) => c.ConvenioId == contrato.ConvenioId);
            configuracionesMap.Add(ConvenioConfiguration);

            MappingConfiguration<DocumentoDigital> DocumentoConfiguration = new MappingConfiguration<DocumentoDigital>();
            DocumentoConfiguration.MapType().ToTable("DOCS_DIGITALES");
            DocumentoConfiguration.HasProperty(c => c.DocumentoId).IsIdentity(KeyGenerator.Autoinc);
            DocumentoConfiguration.
                HasAssociation(dd => dd.TipoDocumentoDigital).WithOpposite(tdd => tdd.DocumentosDigitales).HasConstraint((dd, tdd) => dd.TipoDocumentoDigitalId == tdd.TipoDocumentoDigitalId);
            configuracionesMap.Add(DocumentoConfiguration);

            MappingConfiguration<TipoDocumentoDigital> TipoDocumentoDigitalConfiguration = new MappingConfiguration<TipoDocumentoDigital>();
            TipoDocumentoDigitalConfiguration.MapType().ToTable("TIPOS_DOCS_D");
            TipoDocumentoDigitalConfiguration.HasProperty(tdd => tdd.TipoDocumentoDigitalId).IsIdentity(KeyGenerator.Autoinc);
            configuracionesMap.Add(TipoDocumentoDigitalConfiguration);

            MappingConfiguration<ServicioMantencion> ServicioMantencionConfiguration = new MappingConfiguration<ServicioMantencion>();
            ServicioMantencionConfiguration.MapType().ToTable("SERVICIOS_MANT");
            ServicioMantencionConfiguration.HasProperty(c => c.ServicioMantencionId).IsIdentity(KeyGenerator.Autoinc);
            configuracionesMap.Add(ServicioMantencionConfiguration);

            MappingConfiguration<Pago> PagoConfiguration = new MappingConfiguration<Pago>();
            PagoConfiguration.MapType().ToTable("PAGOS");
            PagoConfiguration.HasProperty(c => c.PagoId).IsIdentity(KeyGenerator.Autoinc);
            configuracionesMap.Add(PagoConfiguration);

            MappingConfiguration<Banco> BancoConfiguration = new MappingConfiguration<Banco>();
            BancoConfiguration.MapType().ToTable("BANCOS");
            BancoConfiguration.HasProperty(c => c.BancoId).IsIdentity(KeyGenerator.Autoinc);
            BancoConfiguration.
                HasAssociation(c => c.Contratos).WithOpposite(contrato => contrato.Banco).HasConstraint((c, contrato) => c.BancoId == contrato.BancoId);
            configuracionesMap.Add(BancoConfiguration);

            MappingConfiguration<ConjuntoHabitacional> ConjuntoHabitacionalConfiguration = new MappingConfiguration<ConjuntoHabitacional>();
            ConjuntoHabitacionalConfiguration.MapType().ToTable("CONJUNTOS_HAB");
            ConjuntoHabitacionalConfiguration.HasProperty(c => c.ConjuntoHabitacionalId).IsIdentity(KeyGenerator.Autoinc);
            configuracionesMap.Add(ConjuntoHabitacionalConfiguration);

            MappingConfiguration<Region> RegionConfiguration = new MappingConfiguration<Region>();
            RegionConfiguration.MapType().ToTable("REGIONES");
            RegionConfiguration.HasProperty(c => c.RegionId).IsIdentity(KeyGenerator.Autoinc);
            configuracionesMap.Add(RegionConfiguration);

            MappingConfiguration<Comuna> ComunaConfiguration = new MappingConfiguration<Comuna>();
            ComunaConfiguration.MapType().ToTable("COMUNAS");
            ComunaConfiguration.HasProperty(c => c.Id).IsIdentity(KeyGenerator.Autoinc);
//.........这里部分代码省略.........
开发者ID:BRozas,项目名称:immobilis,代码行数:101,代码来源:FluentModelMetadataSource.cs

示例13: PrepareSupplierAssociationConfigurations

		public void PrepareSupplierAssociationConfigurations(MappingConfiguration<Supplier> configuration)
		{
			configuration.HasAssociation(x => x.Products).HasFieldName("_products").WithOpposite(x => x.Supplier).ToColumn("SupplierID").HasConstraint((y, x) =>  x.SupplierID == y.SupplierID ).WithDataAccessKind(DataAccessKind.ReadWrite);
		}
开发者ID:psotirov,项目名称:TelerikAcademyProjects,代码行数:4,代码来源:NorthwindFluentModel.cs

示例14: PrepareMapping

        protected override IList<MappingConfiguration> PrepareMapping()
        {
            var configurations =
                new List<MappingConfiguration>();

            //config mapping
            var messageMapping = new MappingConfiguration<Message>();
            messageMapping
            .MapType(message => new
            {
                ID = message.Id,
                message.Content,
                message.SenderId,
                message.RecipientId,
                message.Signature,
                message.InitVector,
                message.SessionKey,
                message.SentTime
            }).ToTable("Messages");
            messageMapping
            .HasProperty(e => e.Id)
            .IsIdentity(KeyGenerator.Autoinc);

            var userMapping = new MappingConfiguration<User>();
            userMapping
            .MapType(user => new
            {
                ID = user.Id,
                user.PasswordHash,
                user.PushToken,
                user.DeviceId,
                user.AllowPush
            }).ToTable("Users");
            userMapping
            .HasProperty(e => e.Id)
            .IsIdentity(KeyGenerator.Autoinc);

            var sessionMapping = new MappingConfiguration<Session>();
            sessionMapping
            .MapType(session => new
            {
                session.UserId,
                session.SessionKey,
                session.StarTime
            }).ToTable("Sessions");

            var dateTimePropertyConfig = sessionMapping.HasProperty(s=> s.StarTime);
            dateTimePropertyConfig.IsCalculatedOn(DateTimeAutosetMode.InsertAndUpdate);

            var contactMapping = new MappingConfiguration<Contact>();
            contactMapping
            .MapType(contact => new
            {
                ID = contact.Id,
                contact.Name,
                contact.PublicKey,
                contact.SenderId,
                contact.RecipientId
            }).ToTable("Contacts");

            //set relations
            contactMapping
            .HasAssociation(e => e.Sender)
                .ToColumn("SenderId")
                .HasConstraint((m, u) => m.SenderId == u.Id);
            contactMapping
            .HasAssociation(e => e.Recipient)
                .ToColumn("RecipientId")
                .WithOpposite(u => u.ReceivedContacts)
                .HasConstraint((m, u) => m.RecipientId == u.Id);

            messageMapping
            .HasAssociation(e => e.Sender)
                .ToColumn("SenderId")
                .HasConstraint((m, u) => m.SenderId == u.Id);
            messageMapping
            .HasAssociation(e => e.Recipient)
                .ToColumn("RecipientId")
                .WithOpposite(u => u.ReceivedMessages)
                .HasConstraint((m, u) => m.RecipientId == u.Id);

            sessionMapping
                .HasAssociation(s => s.User)
                .ToColumn("UserId")
                .HasConstraint((m, u) => m.UserId == u.Id);

            //add configs
            configurations.Add(messageMapping);
            configurations.Add(userMapping);
            configurations.Add(sessionMapping);
            configurations.Add(contactMapping);

            return configurations;
        }
开发者ID:QRyptoWire,项目名称:qrypto-wire,代码行数:94,代码来源:TelerikMetadataSource.cs

示例15: PrepareGroupAssociationConfigurations

		public void PrepareGroupAssociationConfigurations(MappingConfiguration<Group> configuration)
		{
			configuration.HasAssociation(x => x.Users).HasFieldName("_users").WithOpposite(x => x.Group).ToColumn("GroupId").HasConstraint((y, x) =>  x.GroupId == y.GroupId ).WithDataAccessKind(DataAccessKind.ReadWrite);
		}
开发者ID:psotirov,项目名称:TelerikAcademyProjects,代码行数:4,代码来源:NorthwindFluentModel.cs


注:本文中的MappingConfiguration.HasAssociation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。