Example #1
0
        public MasterDetailRelationship AddDetailRelationship(Type detailType, string masterPropertyName, string foreignPropertyName)
        {
            if (detailType is null)
            {
                throw new ArgumentNullException(nameof(detailType));
            }

            if (string.IsNullOrWhiteSpace(foreignPropertyName))
            {
                throw new ArgumentNullException(nameof(foreignPropertyName));
            }

            if (string.IsNullOrWhiteSpace(masterPropertyName))
            {
                throw new ArgumentNullException(nameof(masterPropertyName));
            }

            ValidationDetailRelationshipCanBeAdded(detailType);

            var masterDetailRelationship = new MasterDetailRelationship(masterPropertyName, foreignPropertyName);

            detailRelationships.Add(detailType.FullName, masterDetailRelationship);

            return(masterDetailRelationship);
        }
Example #2
0
        public MasterDetailRelationship AddDetailRelationship(Type detailType)
        {
            if (detailType is null)
            {
                throw new ArgumentNullException(nameof(detailType));
            }

            ValidationDetailRelationshipCanBeAdded(detailType);

            var masterDetailRelationship = new MasterDetailRelationship();

            detailRelationships.Add(detailType.FullName, masterDetailRelationship);

            return(masterDetailRelationship);
        }