Пример #1
0
 protected RelationshipAttribute(string foreignKey, string inverseForeignKey, string inverseProperty, OnDeleteAction onDeleteAction)
 {
     InverseForeignKey = inverseForeignKey;
     InverseProperty   = inverseProperty;
     ForeignKey        = foreignKey;
     OnDeleteAction    = onDeleteAction;
 }
Пример #2
0
        public void AddFK(IDataContext db, string columnName, string refTable, OnDeleteAction act)
        {
            if (db == null)
            {
                throw new ArgumentNullException("session");
            }
            if (string.IsNullOrEmpty(columnName))
            {
                throw new ArgumentNullException("columnName");
            }
            if (!NamingRule.IsValidSqlName(columnName))
            {
                throw new ArgumentOutOfRangeException("columnName");
            }
            if (string.IsNullOrEmpty(refTable))
            {
                throw new ArgumentNullException("refTable");
            }

            var onDelete = OnDeleteMapping[act];
            var fkName   = this.GenerateFkName(columnName);
            var sql      = string.Format(CultureInfo.InvariantCulture,
                                         "alter table \"{0}\" add constraint \"{1}\" foreign key (\"{2}\") references \"{3}\" on delete {4}",
                                         this.Name, fkName, columnName, refTable, onDelete);

            db.Execute(SqlString.Parse(sql));
        }
        public void OnGUI()
        {
            _scroll = BeginScrollView(_scroll);

            switch (_inspectionObject)
            {
            case InputGroup group:
                group.groupName = NameField(group.groupName);

                if (DeleteButton())
                {
                    OnDeleteGroup.Invoke(group);
                }

                break;

            case InspectorInputAction action:
                action.action.actionName = NameField(action.action.actionName);

                DisplayKeys(action.action);
                Space();

                if (DeleteButton())
                {
                    OnDeleteAction.Invoke(action);
                }
                break;

            case InspectorInputAxis axis:
                axis.axis.axisName = NameField(axis.axis.axisName);

                EditorChangeChecker.BeginChangeCheck(InputMapWindow.SetMapDirty);
                axis.axis.positiveAction = TextField("Positive", axis.axis.positiveAction);
                axis.axis.negativeAction = TextField("Negative", axis.axis.negativeAction);
                EditorChangeChecker.EndChangeCheckAndCleanup();

                if (DeleteButton())
                {
                    OnDeleteAxis.Invoke(axis);
                }
                break;

            case InputAction _:
                HelpBox(new GUIContent($"Use '{nameof(InspectorInputAction)}' instead of '{nameof(InputAction)}'!"));
                break;

            case InputAxis _:
                HelpBox(new GUIContent($"Use '{nameof(InspectorInputAxis)}' instead of '{nameof(InputAxis)}'!"));
                break;
            }

            EndScrollView();

            if (OnNextRepaint != null && Event.current.type == EventType.Repaint)
            {
                OnNextRepaint?.Invoke();
                OnNextRepaint = null;
                InputMapWindow.GetEditorWindow().Repaint();
            }
        }
 protected RelationshipAttribute(string foreignKey, string inverseForeignKey, string inverseProperty, OnDeleteAction onDeleteAction)
 {
     InverseForeignKey = inverseForeignKey;
     InverseProperty = inverseProperty;
     ForeignKey = foreignKey;
     OnDeleteAction = onDeleteAction;
 }
 protected override void InvokeInternal(CommandProcessorContext cpc)
 {
     // if the OnDeleteAction already exists then only change the action value
     _createdAction = _parentEnd.OnDeleteAction;
     if (_createdAction == null)
     {
         _createdAction            = new OnDeleteAction(_parentEnd, null);
         _parentEnd.OnDeleteAction = _createdAction;
     }
     _createdAction.Action.Value = _action;
     XmlModelHelper.NormalizeAndResolve(_createdAction);
 }
Пример #6
0
		public void OnDelete(OnDeleteAction deleteAction)
		{
			switch (deleteAction)
			{
				case OnDeleteAction.NoAction:
					mapping.ondelete = HbmOndelete.Noaction;
					break;
				case OnDeleteAction.Cascade:
					mapping.ondelete = HbmOndelete.Cascade;
					break;
			}
		}
Пример #7
0
        public void OnDelete(OnDeleteAction deleteAction)
        {
            switch (deleteAction)
            {
            case OnDeleteAction.NoAction:
                mapping.ondelete = HbmOndelete.Noaction;
                break;

            case OnDeleteAction.Cascade:
                mapping.ondelete = HbmOndelete.Cascade;
                break;
            }
        }
Пример #8
0
        public virtual string GetOnDeleteActionValue(OnDeleteAction onDeleteAction)
        {
            switch (onDeleteAction)
            {
            default:
            case OnDeleteAction.NoAction:
                return("NO ACTION");

            case OnDeleteAction.Cascade:
                return("CASCADE");

            case OnDeleteAction.SetNull:
                return("SET NULL");

            case OnDeleteAction.SetDefault:
                return("SET DEFAULT");
            }
        }
Пример #9
0
 public ManyToOneAttribute(string foreignKey = null, string inverseProperty = null, OnDeleteAction onDeleteAction = OnDeleteAction.None)
     : base(foreignKey, null, inverseProperty, onDeleteAction)
 {
 }
Пример #10
0
 public DatabaseTableColumn SetAsForeignKey(string tableName, string columnName, OnDeleteAction onDeleteAction = OnDeleteAction.NoAction)
 {
     DataConstraints    |= DataConstraint.ForeignKey;
     ForeignKeyReference = new GenericTriple <string, string, OnDeleteAction>(tableName, columnName, onDeleteAction);
     return(this);
 }
Пример #11
0
 public void OnDelete(OnDeleteAction deleteAction)
 {
     CustomizersHolder.AddCustomizer(typeof(TEntity), (IJoinAttributesMapper m) => m.Key(x => x.OnDelete(deleteAction)));
 }
Пример #12
0
 public ManyToManyAttribute(Type intermediateType, string inverseForeignKey = null, string inverseProperty = null, OnDeleteAction onDeleteAction = OnDeleteAction.None)
     : base(null, inverseForeignKey, inverseProperty, onDeleteAction)
 {
     IntermediateType = intermediateType;
 }
Пример #13
0
 public OneToManyAttribute(string inverseForeignKey = null, string inverseProperty = null, OnDeleteAction onDeleteAction = OnDeleteAction.None)
     : base(null, inverseForeignKey, inverseProperty, onDeleteAction)
 {
 }
Пример #14
0
 public OneToOneAttribute(string foreignKey = null, string inverseProperty = null, OnDeleteAction onDeleteAction = OnDeleteAction.None)
     : base(foreignKey, null, inverseProperty, onDeleteAction)
 {
 }
Пример #15
0
 public void OnDelete(OnDeleteAction deleteAction)
 {
     CustomizersHolder.AddCustomizer(propertyPath, (ICollectionPropertiesMapper m) => m.Key(x => x.OnDelete(deleteAction)));
 }
Пример #16
0
 public IField OnDelete(OnDeleteAction act)
 {
     this.OnDeleteAction = act;
     return(this);
 }
Пример #17
0
 public void RaiseOnDeleteAction() => OnDeleteAction?.Invoke(this, new EventArgs());
Пример #18
0
 public ManyToManyAttribute(Type intermediateType, string inverseForeignKey = null, string inverseProperty = null, OnDeleteAction onDeleteAction = OnDeleteAction.None)
     : base(null, inverseForeignKey, inverseProperty, onDeleteAction)
 {
     IntermediateType = intermediateType;
 }