<PAGE>

                                                                    EXHIBIT 10.4

                                 FIRST AMENDMENT
                                       OF
                           SECOND AMENDED AND RESTATED
                        AGREEMENT OF LIMITED PARTNERSHIP
                                       OF
                            HERITAGE COMMUNITIES L.P.

     THIS FIRST AMENDMENT OF SECOND AMENDED AND RESTATED AGREEMENT OF LIMITED
PARTNERSHIP OF HERITAGE COMMUNITIES L.P. ("First Amendment"), made as of the
27th day of March, 1998, by ASR INVESTMENTS CORPORATION, a Maryland corporation
("ASR"), as General Partner, and HERITAGE SGP CORPORATION, an Arizona
corporation ("Heritage SGP"), as Special General Partner, and joined in by
UNITED DOMINION REALTY TRUST, INC., a Virginia corporation ("UDR"), for the
purposes herein specified.

                                    RECITALS

ASR is the General Partner and Heritage SGP is the Special General Partner of
Heritage Communities L.P., a Delaware partnership existing under a Second
Amended and Restated Agreement of Limited Partnership of Heritage Communities
L.P., dated as of September 18, 1997 (the "Partnership Agreement", by and among
ASR, as General Partner, Heritage SGP, as Special General Partner, and the
persons identified in Exhibit A thereto, as Limited Partners (the "Limited
Partners"). Terms used and not defined herein are defined in the Partnership
Agreement. Upon consummation of an Agreement and Plan of Merger dated as of
December 19, 1997 (the "Merger Agreement"), among UDR, ASR and ASR Acquisition
Sub, Inc., a Maryland corporation ("Sub"), Sub will merge with and into ASR (the
"Merger"), each outstanding share of Common Stock, $.01 par value, of ASR ("ASR
Common Stock") will be converted into 1.575 shares of Common Stock, $1.00 par
value, of UDR ("UDR Common Stock"), with cash in lieu of any fractional share,
ASR will become a wholly-owned subsidiary of UDR and the public market for ASR
Common Stock will terminate. Section 11.2.2 of the Partnership Agreement
prohibits the General Partner from engaging in the Merger unless appropriate
provision is made as a part of the terms of such Transaction so that each
Limited Partner thereafter remains entitled to exchange each Limited Partner
Unit owned by such Limited Partner (after application of the Unit Adjustment
Factor) for an amount of cash, securities or other property equal to the
greatest amount of cash, securities or other property which such Limited Partner
would have received from such Transaction, if such Limited Partner had exercised
its Conversion Right immediately prior to the Transaction. In Section 5.12 of
the Merger Agreement, UDR undertakes to make the provision for the Limited
Partners required by Section 11.2.2 of the Partnership Agreement, and UDR and
ASR have agreed that amendment of the Partnership Agreement as provided herein
is the most efficient means therefor. ASR is authorized so to amend the
Partnership Agreement under Section 14.2(c) thereof without the consent of the
Limited Partners.

<PAGE>

NOW, THEREFORE, the Partnership Agreement is amended as follows:

11.  Section 1.1.10 of the Partnership Agreement is amended to read as follows:

   Section 1.1.10. "Articles of Incorporation" means, as the context may
   indicate, the Articles of Incorporation of ASR Investments Corporation, as
   filed with the Secretary of State of the State of Maryland, or the Articles
   of Incorporation of UDR, as filed in the Clerk's Office of the Virginia
   State Corporation Commission, in either case as further amended or restated
   from time to time.

12.  Section 1.1.72 of the Partnership Agreement is amended to read as follows:

   Section 1.1.72. "Shares" means the shares of Common Stock, $1.00 par value,
   of UDR.

13.  The reference to the General Partner in Section 1.1.80 of the Partnership
Agreement shall be deemed a reference to UDR.

14.  New Sections 1.1.88, 1.1.89 and 1.1.90 are added to the Partnership
Agreement, as follows:

   Section 1.1.88. "Merger" means the merger of ASR Acquisition Sub, Inc., a
   Maryland corporation, with and into the General Partner.

   Section 1.1.89. "Merger Closing Date" means March 27, 1998, or such other
   date on which the merger shall become effective.

   Section 1.1.90. "UDR" means United Dominion Realty Trust, Inc., a Virginia
   corporation.

15.  Sections 4.2.2(a) and (b) of the Partnership Agreement are amended to read
as follows:

     (i)  (a)  Subject to the further provisions of this Section 4.2.2 and
subject to Section 8.6, each Person who was a Limited Partner on the Merger
Closing date shall have the right (the "Conversion Right") to exchange any or
all of the Limited Partner Units held by that Partner for Shares, with one
Limited Partner Unit (as adjusted pursuant to 4.2.2(b)) being exchangeable for
1.575 fully paid, non-assessable Shares. In the event that any exercise of the
Conversion Right shall result in such Limited Partner being entitled to receive
a fractional Share, such Limited Partner shall receive a cash payment in lieu of
such fractional Share equal to such fractional proportion of the closing price
per Share on the New York Stock Exchange, reported as "New York Stock Exchange
Composite Transactions" by The Wall Street Journal, on the Merger Closing Date.

          (b)  Subject to the further provisions of this Section 4.2.2 and
subject to Section 8.6, each Person who becomes a Limited Partner at any time
after the Merger Closing Date shall have the right (the "Conversion Right") to
exchange any or all of the Limited Partner Units held by that Partner for
Shares, with one Limited Partner Unit (as adjusted pursuant to 4.2.2(b)) being
exchangeable for one fully paid, non-assessable Share.

                                       2

<PAGE>

          (c)  The Conversion Right may be exercised by a Limited Partner (a
"Converting Partner") at any time after the first anniversary of the issuance of
the Limited Partner Unit that is the subject of Notice of Conversion and from
time to time thereafter by delivering such Notice of Conversion in the form
attached as Exhibit C to the General Partner. Upon receipt by the General
Partner of a Notice of Conversion, on the Specified Conversion date, UDR shall
issue to the Converting Partner the number of Shares to which the Converting
Partner is entitled under (i) or (ii) above, as appropriate, based on the number
of Limited Partner Units to be exchanged, together with the fractional Share
cash payment, if any, to which such Converting Partner is entitled. UDR shall at
all times reserve and keep available out of its authorized but unissued Shares,
solely for the purpose of effecting the exchange of Limited Partner Units for
Shares, such number of Shares as shall from time to time be sufficient to effect
the conversion of all outstanding Limited Partner Units. No Limited Partner
shall, solely by virtue of being the holder of one or more limited Partner
Units, be deemed to be a shareholder of or have any other interest in UDR.

     (ii) For purposes of this Section 4.2.2, the number of Limited Partner
Units exchanged by any Limited Partner shall be proportionately adjusted by
multiplying the number of Limited Partner Units being exchange by such Limited
Partner by the Unit Adjustment Factor: the intent of this provision is that one
Limited Partner Unit (as adjusted) remains exchangeable for 1.575 Shares or one
Share, as the case may be, without dilution. In the event UDR issues any Shares
in exchange for Limited Partner Units pursuant to this section 4.2.2, any such
Limited Partner Units so acquired by UDR shall thereafter be owned by UDR as
Limited Partner Units for all purposes of this Agreement, except for those
actions requiring the vote of the Limited Partners or Limited Partner Consent.
Each Converting Partner agrees to execute such documents as UDR may reasonably
require in connection with the issuance of Shares upon exercise of the
Conversion Right.

16.  All reference to the General Partner in Section 8.6 of the Partnership
Agreement shall be deemed references to UDR.

17.  This First Amendment shall become effective on the Merger Closing Date.

18.  UDR joins in this First Amendment for purposes of evidencing its acceptance
of and agreement to be bound by the terms of the Partnership Agreement as
amended hereby.

                                       3

<PAGE>

     IN WITNESS WHEREOF, ASR, Heritage SGP and UDR have caused this First
Amendment to be signed by their respective officers thereunto duly authorized,
all as of the date first written above.

--------------------------------------------------------------------------------
                                        ASR INVESTMENTS CORPORATION


                                        By:   /s/ [illegible]
                                             -----------------------------------
                                        Its: President


--------------------------------------------------------------------------------
                                        HERITAGE SGP CORPORATION


                                        By:   /s/ [illegible]
                                             -----------------------------------
                                        Its: President


--------------------------------------------------------------------------------
                                        UNITED DOMINION REALTY TRUST, INC.


                                        By:   /s/ Kathryn Surface
                                             -----------------------------------
                                        Its: Senior Vice President


--------------------------------------------------------------------------------

                                       4